[MDEV-18907] Slow log: RENAME TABLE is not "admin", while ALTER TABLE..RENAME is Created: 2019-03-13  Updated: 2019-03-13  Resolved: 2019-03-13

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.1, 10.2, 10.3, 10.4
Fix Version/s: 10.1.39

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-18333 Slow_queries count doesn't increase w... Closed

 Description   

RENAME TABLE is not an "admin" command from the point of view of slow log. Its alias "ALTER TABLE..RENAME" is. They should be both "admin" for consistency.

This script demonstrates that RENAME TABLE does not honor log_slow_filter='admin':

SET @@GLOBAL.slow_query_log=OFF;
SET @@GLOBAL.log_output='TABLE';
TRUNCATE TABLE mysql.slow_log;
FLUSH SLOW LOGS;
SET @@GLOBAL.slow_query_log=ON;
 
SET @@GLOBAL.log_slow_admin_statements=ON;
SET log_slow_filter='admin';
SET long_query_time=0.000001;
 
DROP TABLE IF EXISTS t1,t2,t3;
CREATE TABLE t1 (a INT);
ALTER TABLE t1 RENAME t2;
RENAME TABLE t2 TO t3;
DROP TABLE t3;
 
SELECT sql_text FROM mysql.slow_log;

+--------------------------+
| sql_text                 |
+--------------------------+
| ALTER TABLE t1 RENAME t2 |
+--------------------------+


Generated at Thu Feb 08 08:47:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.