diff options
author | Kristian Nielsen <knielsen@knielsen-hq.org> | 2014-10-22 13:51:33 +0200 |
---|---|---|
committer | Kristian Nielsen <knielsen@knielsen-hq.org> | 2014-10-22 13:51:33 +0200 |
commit | 64af1ecc20ac4a21ee2a61c91d91fae98debd036 (patch) | |
tree | 6dda11d1031cc574dc445338a30bcce0cb4393a8 /mysql-test | |
parent | a050a87f78fa588959cbb701b035424688d064c1 (diff) | |
download | mariadb-git-64af1ecc20ac4a21ee2a61c91d91fae98debd036.tar.gz |
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.
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/processlist.result | 8 | ||||
-rw-r--r-- | mysql-test/t/processlist.test | 11 |
2 files changed, 15 insertions, 4 deletions
diff --git a/mysql-test/r/processlist.result b/mysql-test/r/processlist.result index 127fa96b84b..af97aba6634 100644 --- a/mysql-test/r/processlist.result +++ b/mysql-test/r/processlist.result @@ -1,15 +1,17 @@ SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time'; SELECT 1; 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 SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed'; -INFO TIME TIME_MS -NULL 0 0.000 +ID TIME TIME_MS +TID 0 0.000 +SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done'; select sleep(5); sleep(5) 0 +SET DEBUG_SYNC = 'now WAIT_FOR query_done'; select command, time < 5 from information_schema.processlist where id != connection_id(); command time < 5 Sleep 1 diff --git a/mysql-test/t/processlist.test b/mysql-test/t/processlist.test index 7a2b33699d5..12dd665b71b 100644 --- a/mysql-test/t/processlist.test +++ b/mysql-test/t/processlist.test @@ -4,19 +4,22 @@ source include/have_debug_sync.inc; +let $tid= `SELECT CONNECTION_ID()`; SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time'; send SELECT 1; connect (con1,localhost,root,,); 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; reap; SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed'; connection con1; +--replace_result $tid TID reap; connection default; @@ -25,9 +28,15 @@ connection default; # connection con1; +SET DEBUG_SYNC = 'dispatch_command_end SIGNAL query_done'; select sleep(5); #run a query that will take some time 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 select command, time < 5 from information_schema.processlist where id != connection_id(); |