Backporting slow log simulation logic details from 10.2 to 10.1
Simulate slow statements only for COM_QUERY and COM_STMT_EXECUTE commands, to exclude mysqld_stmt_prepare() and mysqld_stmt_close() entries from the log, as they are not relevant for log_slow_debug.test. This simplifies the test.
This commit is contained in:
parent
9c9bf9642e
commit
f704361cd6
@ -14,14 +14,6 @@ FROM mysql.slow_log
|
||||
WHERE sql_text NOT LIKE '%debug_dbug%';
|
||||
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)
|
||||
#
|
||||
@ -41,7 +33,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t4;
|
||||
CALL show_slow_log_exclude_ps();
|
||||
CALL show_slow_log();
|
||||
sql_text
|
||||
[slow] TRUNCATE TABLE mysql.slow_log
|
||||
[slow] CREATE TABLE t1 (a INT)
|
||||
@ -123,7 +115,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t4;
|
||||
CALL show_slow_log_exclude_ps();
|
||||
CALL show_slow_log();
|
||||
sql_text
|
||||
[slow] TRUNCATE TABLE mysql.slow_log
|
||||
[slow] CREATE TABLE t1 (a INT)
|
||||
@ -143,4 +135,3 @@ SET @@global.slow_query_log= @org_slow_query_log;
|
||||
SET @@global.log_output= @org_log_output;
|
||||
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
|
||||
DROP PROCEDURE show_slow_log;
|
||||
DROP PROCEDURE show_slow_log_exclude_ps;
|
||||
|
@ -19,14 +19,6 @@ BEGIN
|
||||
WHERE sql_text NOT LIKE '%debug_dbug%';
|
||||
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 ;$$
|
||||
|
||||
|
||||
@ -50,7 +42,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t4;
|
||||
CALL show_slow_log_exclude_ps();
|
||||
CALL show_slow_log();
|
||||
|
||||
|
||||
--echo #
|
||||
@ -119,7 +111,7 @@ PREPARE stmt FROM 'ALTER TABLE t4 MODIFY a INT DEFAULT 1';
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
DROP TABLE t4;
|
||||
CALL show_slow_log_exclude_ps();
|
||||
CALL show_slow_log();
|
||||
|
||||
|
||||
--echo #
|
||||
@ -132,4 +124,3 @@ SET @@global.slow_query_log= @org_slow_query_log;
|
||||
SET @@global.log_output= @org_log_output;
|
||||
SET @@global.log_slow_admin_statements= @org_log_slow_admin_statements;
|
||||
DROP PROCEDURE show_slow_log;
|
||||
DROP PROCEDURE show_slow_log_exclude_ps;
|
||||
|
@ -2048,8 +2048,11 @@ void log_slow_statement(THD *thd)
|
||||
if (!thd->enable_slow_log)
|
||||
goto end; // E.g. SP statement
|
||||
|
||||
DBUG_EXECUTE_IF("simulate_slow_query",
|
||||
thd->server_status|= SERVER_QUERY_WAS_SLOW;);
|
||||
DBUG_EXECUTE_IF("simulate_slow_query", {
|
||||
if (thd->get_command() == COM_QUERY ||
|
||||
thd->get_command() == COM_STMT_EXECUTE)
|
||||
thd->server_status|= SERVER_QUERY_WAS_SLOW;
|
||||
});
|
||||
|
||||
if (((thd->server_status & SERVER_QUERY_WAS_SLOW) ||
|
||||
((thd->server_status &
|
||||
|
Loading…
x
Reference in New Issue
Block a user