Commit 8e63a7fe authored by Kristian Nielsen's avatar Kristian Nielsen

Yet another attempt at fixing random failures in test case main.myisam-metadata

I think I finally found the problem, managed to reproduce locally using a
sleep in the test case to simulate the particular race condition that causes
the test to fail often in Buildbot.

The test starts an ALTER TABLE that does repair by sort in one thread, then
another thread waits for the sort to be visible in SHOW PROCESSLIST and runs a
SHOW statement in parallel.

The problem happens when the sort manages to run to completion before the
other thread has the time to look at SHOW PROCESSLIST. In this case, the wait
times out because the state looked for has already passed.

Earlier I added some DEBUG_SYNC to prevent this race, but it turns out that
DEBUG_SYNC itself changes the state in the processlist. So when the debug sync
point was hit, the processlist was showing the wrong state, so the wait would
still time out.

Fixed now by looking for the processlist to contain either the "Repair by
sorting" state or the debug sync wait stage.

Also clean up previous attempts to fix it. Set the wait timeout back to
reasonable 60 seconds, and simplify the DEBUG_SYNC operations to work closer
to how the original test case was intended.
parent ad66fafb
......@@ -5,9 +5,8 @@ a VARCHAR(100),
INDEX(a)
) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go';
SET debug_sync= 'myisam_after_repair_by_sort WAIT_FOR go';
ALTER TABLE t1 ENABLE KEYS;
SET debug_sync= 'now WAIT_FOR waiting';
SET debug_sync= 'now SIGNAL go';
SHOW TABLE STATUS LIKE 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
......
......@@ -30,17 +30,22 @@ while ($1)
--enable_query_log
--connect(con1,localhost,root,,)
SET debug_sync= 'myisam_after_repair_by_sort SIGNAL waiting WAIT_FOR go';
# Set a debug_sync waitpoint.
# This is just to ensure that the ALTER does not have time to complete
# its operation and change the status away from "Repair by sorting" before
# wait_condition has a chance to see it.
SET debug_sync= 'myisam_after_repair_by_sort WAIT_FOR go';
send
ALTER TABLE t1 ENABLE KEYS;
--connection default
--let $wait_timeout=600
--let $wait_timeout=60
--let $show_statement= SHOW PROCESSLIST
--let $field= State
--let $condition= = 'Repair by sorting'
# If the sort completes early and we hit the debug_sync point, the processlist
# will show the debug_sync state, so we need to check for that also.
--let $condition= RLIKE 'Repair by sorting|myisam_after_repair_by_sort'
--source include/wait_show_condition.inc
SET debug_sync= 'now WAIT_FOR waiting';
SET debug_sync= 'now SIGNAL go';
--replace_column 7 # 8 # 9 # 12 # 13 # 14 #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment