Commit e9c494c8 authored by Alexander Barkov's avatar Alexander Barkov

Fixing a failure in tests for "MDEV-18892 Regression in slow log and admin statements"

Tests for MDEV-18892 failed, because of extra 'Prepare' and 'Close stmt'
entries in the output.

Filtering out PS related entries (where it is necessary).
parent ef81d2ea
...@@ -14,6 +14,14 @@ FROM mysql.slow_log ...@@ -14,6 +14,14 @@ FROM mysql.slow_log
WHERE sql_text NOT LIKE '%debug_dbug%'; WHERE sql_text NOT LIKE '%debug_dbug%';
END END
$$ $$
CREATE PROCEDURE show_slow_log_exclude_ps()
BEGIN
SELECT CONCAT('[slow] ', sql_text) AS sql_text
FROM mysql.slow_log
WHERE sql_text NOT LIKE '%debug_dbug%'
AND sql_text NOT IN ('Prepare','Close stmt');
END
$$
# #
# Expect all admin statements in the slow log (ON,DEFAULT) # Expect all admin statements in the slow log (ON,DEFAULT)
# #
...@@ -33,7 +41,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; ...@@ -33,7 +41,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t4; DROP TABLE t4;
CALL show_slow_log(); CALL show_slow_log_exclude_ps();
sql_text sql_text
[slow] TRUNCATE TABLE mysql.slow_log [slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT) [slow] CREATE TABLE t1 (a INT)
...@@ -115,7 +123,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; ...@@ -115,7 +123,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t4; DROP TABLE t4;
CALL show_slow_log(); CALL show_slow_log_exclude_ps();
sql_text sql_text
[slow] TRUNCATE TABLE mysql.slow_log [slow] TRUNCATE TABLE mysql.slow_log
[slow] CREATE TABLE t1 (a INT) [slow] CREATE TABLE t1 (a INT)
...@@ -135,3 +143,4 @@ SET @@global.slow_query_log= @org_slow_query_log; ...@@ -135,3 +143,4 @@ SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output; SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements; SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log; DROP PROCEDURE show_slow_log;
DROP PROCEDURE show_slow_log_exclude_ps;
...@@ -19,6 +19,14 @@ BEGIN ...@@ -19,6 +19,14 @@ BEGIN
WHERE sql_text NOT LIKE '%debug_dbug%'; WHERE sql_text NOT LIKE '%debug_dbug%';
END END
$$ $$
CREATE PROCEDURE show_slow_log_exclude_ps()
BEGIN
SELECT CONCAT('[slow] ', sql_text) AS sql_text
FROM mysql.slow_log
WHERE sql_text NOT LIKE '%debug_dbug%'
AND sql_text NOT IN ('Prepare','Close stmt');
END
$$
DELIMITER ;$$ DELIMITER ;$$
...@@ -42,7 +50,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; ...@@ -42,7 +50,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t4; DROP TABLE t4;
CALL show_slow_log(); CALL show_slow_log_exclude_ps();
--echo # --echo #
...@@ -111,7 +119,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1'; ...@@ -111,7 +119,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
EXECUTE stmt; EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t4; DROP TABLE t4;
CALL show_slow_log(); CALL show_slow_log_exclude_ps();
--echo # --echo #
...@@ -124,3 +132,4 @@ SET @@global.slow_query_log= @org_slow_query_log; ...@@ -124,3 +132,4 @@ SET @@global.slow_query_log= @org_slow_query_log;
SET @@global.log_output= @org_log_output; SET @@global.log_output= @org_log_output;
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements; SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
DROP PROCEDURE show_slow_log; DROP PROCEDURE show_slow_log;
DROP PROCEDURE show_slow_log_exclude_ps;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment