#At file:///home/sven/bzr/b39851-check_testcase_race/5.1-rpl/
2668 Sven Sandberg 2008-10-04
BUG#39851: race between check_testcase and tests running 'show processlist'
Problem: check_testcase executes a query to the server. Subsequent test cases may
run SHOW PROCESSLIST, which may print the process executing the query (the query
sends 'ack' to the client before the process dies). So there is a race.
Fix: check_testcase should wait until the process is dead.
modified:
mysql-test/include/check-testcase.test
per-file messages:
mysql-test/include/check-testcase.test
Wait until the thread executing mtr.check_testcase() is dead, to remove race
in tests that run SHOW PROCESSLIST.
=== modified file 'mysql-test/include/check-testcase.test'
--- a/mysql-test/include/check-testcase.test 2008-04-09 10:27:39 +0000
+++ b/mysql-test/include/check-testcase.test 2008-10-04 08:41:51 +0000
@@ -1,15 +1,24 @@
-
#
# This test is executed twice for each test case if mysql-test-run is passed
# the flag --check-testcase. Before every testcase it is run with mysqltest
# in record mode and will thus produce an output file that can be compared
# to output from after the tescase.
-# In that way its possible to check that a testcase does not have
+# In that way it's possible to check that a testcase does not have
# any unwanted side affects.
#
--disable_query_log
call mtr.check_testcase();
---enable_query_log
-
-
+# Wait until the process executing the previous statement is dead:
+# otherwise there would be a race with test cases that run "SHOW
+# PROCESSLIST" early.
+let $counter= 300;
+while (`SHOW PROCESSLIST WHERE COMMAND = 'call mtr.check_testcase()'`) {
+ sleep 0.1;
+ dec $counter;
+ if (!$counter) {
+ --echo query 'call mtr.check_testcase()' did not terminate
+ exit;
+ }
+}
+--enable_query_log
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (sven:2668) Bug#39851 | Sven Sandberg | 4 Oct |