Skip to content

Commit a43524c

Browse files
committed
GCF-1058 MTR test galera.MW-86 fails on repeated runs
Wait for the sync point sync.wsrep_apply_cb to be reached before executing the test and clearing the debug flag sync.wsrep_apply_cb. The race scenario: Intended behavior: node2: set sync.wsrep_apply_cb in order to start waiting in the background INSERT node1: INSERT start node2 (background): INSERT start node1: INSERT end node2: send signal to background INSERT: "stop waiting and continue executing" node2: clear sync.wsrep_apply_cb as no longer needed node2 (background): consume the signal node2 (background): INSERT end node2: DROP TABLE node2: check no pending signals are left - ok What happens occasionally (unexpected): node2: set sync.wsrep_apply_cb in order to start waiting in the background INSERT node1: INSERT start node2 (background): INSERT start node1: INSERT end // The background INSERT still has _not_ reached the place where it starts // waiting for the signal: // DBUG_EXECUTE_IF("sync.wsrep_apply_cb", "now wait_for..."); node2: send signal to background INSERT: "stop waiting and continue executing" node2: clear sync.wsrep_apply_cb as no longer needed // The background INSERT reaches DBUG_EXECUTE_IF("sync.wsrep_apply_cb", ...) // but sync.wsrep_apply_cb has already been cleared and the "wait" code is not // executed. The signal remains unconsumed. node2 (background): INSERT end node2: DROP TABLE node2: check no pending signals are left - failure, signal.wsrep_apply_cb is pending (not consumed)
1 parent 5d00503 commit a43524c

File tree

5 files changed

+8
-1
lines changed

5 files changed

+8
-1
lines changed

mysql-test/suite/galera/r/MW-86-wait1.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SET SESSION wsrep_sync_wait = 1;
55
SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
66
CREATE TABLE t_wait1 (f1 INTEGER) ENGINE=InnoDB;
77
INSERT INTO t_wait1 VALUES (1);
8+
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
89
SHOW BINARY LOGS;
910
SHOW BINLOG EVENTS;
1011
SHOW COLUMNS FROM t1;

mysql-test/suite/galera/r/MW-86-wait8.result

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ SET GLOBAL debug = "+d,sync.wsrep_apply_cb";
66
CREATE TABLE t_wait8 (f1 INTEGER) ENGINE=InnoDB;
77
INSERT INTO t_wait8 VALUES (1);
88
SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT0.1S";
9+
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
910
SHOW BINARY LOGS;
1011
SHOW BINLOG EVENTS;
1112
SHOW COLUMNS FROM t1;

mysql-test/suite/galera/t/MW-86-wait1.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ INSERT INTO t_wait1 VALUES (1);
2222

2323
--connection node_2
2424

25+
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
26+
2527
--disable_result_log
2628

2729
SHOW BINARY LOGS;

mysql-test/suite/galera/t/MW-86-wait8.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ INSERT INTO t_wait8 VALUES (1);
2323
--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
2424
SET GLOBAL wsrep_provider_options = "repl.causal_read_timeout=PT0.1S";
2525

26+
SET SESSION debug_sync = "now WAIT_FOR sync.wsrep_apply_cb_reached";
27+
2628
--disable_result_log
2729

2830
--error ER_LOCK_WAIT_TIMEOUT

sql/wsrep_applier.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,8 @@ wsrep_cb_status_t wsrep_apply_cb(void* const ctx,
207207
{
208208
const char act[]=
209209
"now "
210-
"wait_for signal.wsrep_apply_cb";
210+
"SIGNAL sync.wsrep_apply_cb_reached "
211+
"WAIT_FOR signal.wsrep_apply_cb";
211212
DBUG_ASSERT(!debug_sync_set_action(thd,
212213
STRING_WITH_LEN(act)));
213214
};);

0 commit comments

Comments
 (0)