mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Fix two races in test main.processlist that could cause random failures (seen in Buildbot)
1. Do not use NULL `info' field in processlist to select the thread of interest. This can fail if the read of processlist ends up happening after REAP succeeds, but before the `info' field is reset. Instead, select on the CONNECTION_ID(), making sure we still scan the whole list to trigger the same code as in the original test case. 2. Wait for the query to really complete before reading it in the processlist. When REAP returns, it only means that ack has been sent to client, the reset of query stage happens a bit later in the code.
This commit is contained in:
@ -1,15 +1,17 @@
|
|||||||
SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
|
SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
|
||||||
SELECT 1;
|
SELECT 1;
|
||||||
SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
|
SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
|
||||||
SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL;
|
SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":TID:";
|
||||||
1
|
1
|
||||||
1
|
1
|
||||||
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
|
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
|
||||||
INFO TIME TIME_MS
|
ID TIME TIME_MS
|
||||||
NULL 0 0.000
|
TID 0 0.000
|
||||||
|
SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done';
|
||||||
select sleep(5);
|
select sleep(5);
|
||||||
sleep(5)
|
sleep(5)
|
||||||
0
|
0
|
||||||
|
SET DEBUG_SYNC = 'now WAIT_FOR query_done';
|
||||||
select command, time < 5 from information_schema.processlist where id != connection_id();
|
select command, time < 5 from information_schema.processlist where id != connection_id();
|
||||||
command time < 5
|
command time < 5
|
||||||
Sleep 1
|
Sleep 1
|
||||||
|
@ -4,19 +4,22 @@
|
|||||||
|
|
||||||
source include/have_debug_sync.inc;
|
source include/have_debug_sync.inc;
|
||||||
|
|
||||||
|
let $tid= `SELECT CONNECTION_ID()`;
|
||||||
SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
|
SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
|
||||||
send SELECT 1;
|
send SELECT 1;
|
||||||
|
|
||||||
connect (con1,localhost,root,,);
|
connect (con1,localhost,root,,);
|
||||||
|
|
||||||
SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
|
SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
|
||||||
send SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL;
|
--replace_result $tid TID
|
||||||
|
send_eval SELECT ID, TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE CONCAT(":", ID, ":") = ":$tid:";
|
||||||
|
|
||||||
connection default;
|
connection default;
|
||||||
reap;
|
reap;
|
||||||
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
|
SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
|
||||||
|
|
||||||
connection con1;
|
connection con1;
|
||||||
|
--replace_result $tid TID
|
||||||
reap;
|
reap;
|
||||||
connection default;
|
connection default;
|
||||||
|
|
||||||
@ -25,9 +28,15 @@ connection default;
|
|||||||
#
|
#
|
||||||
|
|
||||||
connection con1;
|
connection con1;
|
||||||
|
SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done';
|
||||||
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;
|
||||||
|
|
||||||
|
# Need to ensure that the previous query has really completed. Otherwise,
|
||||||
|
# the select could see the previous query still in "Query" stage in the
|
||||||
|
# processlist.
|
||||||
|
SET DEBUG_SYNC = 'now WAIT_FOR query_done';
|
||||||
|
|
||||||
# verify that the time in COM_SLEEP doesn't include the query run time
|
# verify that the time in COM_SLEEP doesn't include the query run time
|
||||||
select command, time < 5 from information_schema.processlist where id != connection_id();
|
select command, time < 5 from information_schema.processlist where id != connection_id();
|
||||||
|
|
||||||
|
@ -1505,6 +1505,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
|||||||
}
|
}
|
||||||
MYSQL_COMMAND_DONE(res);
|
MYSQL_COMMAND_DONE(res);
|
||||||
}
|
}
|
||||||
|
DEBUG_SYNC(thd,"dispatch_command_end");
|
||||||
|
|
||||||
/* Check that some variables are reset properly */
|
/* Check that some variables are reset properly */
|
||||||
DBUG_ASSERT(thd->abort_on_warning == 0);
|
DBUG_ASSERT(thd->abort_on_warning == 0);
|
||||||
|
Reference in New Issue
Block a user