mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-7189: main.processlist fails sporadically in buildbot
The test case tried to trigger a DEBUG_SYNC point at the end of a SELECT SLEEP(5) statement. It did this by using EXECUTE 2, intending to trigger first at the end of SET DEBUG_SYNC, and second at the end of the SELECT SLEEP(5). However, in --ps-protocol mode, this does not work, because the SELECT is executed in two steps (Prepare followed by Execute). Thus, the DEBUG_SYNC got triggered too early, during the Prepare stage rather than Execute, and the test case could race and information_schema.processlist see the thread in the wrong state. This patch fixes by changing the way the DEBUG_SYNC point is triggered. Now we add a DBUG injection inside the code for SLEEP(5). This ensures that the DEBUG_SYNC point is not activated until the SLEEP(5) is running, ensuring that the following wait for completion will be effective.
This commit is contained in:
@@ -2495,6 +2495,7 @@ sub environment_setup {
|
|||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
my $exe_replace= mtr_exe_exists(vs_config_dirs('extra', 'replace'),
|
my $exe_replace= mtr_exe_exists(vs_config_dirs('extra', 'replace'),
|
||||||
"$basedir/extra/replace",
|
"$basedir/extra/replace",
|
||||||
|
"$bindir/extra$opt_vs_config/replace",
|
||||||
"$path_client_bindir/replace");
|
"$path_client_bindir/replace");
|
||||||
$ENV{'REPLACE'}= native_path($exe_replace);
|
$ENV{'REPLACE'}= native_path($exe_replace);
|
||||||
|
|
||||||
|
@@ -7,9 +7,8 @@ SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID
|
|||||||
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
|
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
|
||||||
ID TIME TIME_MS
|
ID TIME TIME_MS
|
||||||
TID 0 0.000
|
TID 0 0.000
|
||||||
SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2';
|
set debug_sync='reset';
|
||||||
SET DEBUG_SYNC= 'now WAIT_FOR query_done';
|
SET debug_dbug="+d,sleep_inject_query_done_debug_sync";
|
||||||
SET DEBUG_SYNC= 'now SIGNAL nosignal';
|
|
||||||
select sleep(5);
|
select sleep(5);
|
||||||
sleep(5)
|
sleep(5)
|
||||||
0
|
0
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
# MDEV-4578 information_schema.processlist reports incorrect value for Time (2147483647)
|
# MDEV-4578 information_schema.processlist reports incorrect value for Time (2147483647)
|
||||||
#
|
#
|
||||||
|
|
||||||
|
source include/have_debug.inc;
|
||||||
source include/have_debug_sync.inc;
|
source include/have_debug_sync.inc;
|
||||||
|
|
||||||
let $tid= `SELECT CONNECTION_ID()`;
|
let $tid= `SELECT CONNECTION_ID()`;
|
||||||
@@ -21,6 +22,7 @@ SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
|
|||||||
connection con1;
|
connection con1;
|
||||||
--replace_result $tid TID
|
--replace_result $tid TID
|
||||||
reap;
|
reap;
|
||||||
|
set debug_sync='reset';
|
||||||
connection default;
|
connection default;
|
||||||
|
|
||||||
#
|
#
|
||||||
@@ -28,15 +30,13 @@ connection default;
|
|||||||
#
|
#
|
||||||
|
|
||||||
connection con1;
|
connection con1;
|
||||||
# Trigger a signal once the thread has gone from "Query" to "Sleep" command
|
# This DBUG insertion triggers a DEBUG_SYNC signal "query_done" once
|
||||||
# state. Note we need to execute this twice: Once at the end of SET DEBUG_SYNC,
|
# the below SELECT SLEEP(5) has gone from "Query" to "Sleep" command
|
||||||
# and once for the intended time, at the end of SELECT SLEEP().
|
# state. (We cannot just set the DEBUG_SYNC directly here, because
|
||||||
SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done EXECUTE 2';
|
# then it can trigger at the end of the SET DEBUG_SYNC statement (or
|
||||||
connection default;
|
# at the end of the Prepare step of the SELECT, if --ps-protocol),
|
||||||
# Wait for and clear the first signal set during SET DEBUG_SYNC.
|
# thus occuring too early).
|
||||||
SET DEBUG_SYNC= 'now WAIT_FOR query_done';
|
SET debug_dbug="+d,sleep_inject_query_done_debug_sync";
|
||||||
SET DEBUG_SYNC= 'now SIGNAL nosignal';
|
|
||||||
connection con1;
|
|
||||||
select sleep(5); #run a query that will take some time
|
select sleep(5); #run a query that will take some time
|
||||||
connection default;
|
connection default;
|
||||||
|
|
||||||
|
@@ -4482,6 +4482,11 @@ longlong Item_func_sleep::val_int()
|
|||||||
|
|
||||||
mysql_cond_destroy(&cond);
|
mysql_cond_destroy(&cond);
|
||||||
|
|
||||||
|
DBUG_EXECUTE_IF("sleep_inject_query_done_debug_sync", {
|
||||||
|
debug_sync_set_action
|
||||||
|
(thd, STRING_WITH_LEN("dispatch_command_end SIGNAL query_done"));
|
||||||
|
};);
|
||||||
|
|
||||||
return test(!error); // Return 1 killed
|
return test(!error); // Return 1 killed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user