| 1 |
include/master-slave.inc |
| 2 |
[connection master] |
| 3 |
connection slave; |
| 4 |
include/stop_slave.inc |
| 5 |
SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; |
| 6 |
SET GLOBAL slave_parallel_threads=3; |
| 7 |
SET @old_parallel_mode= @@GLOBAL.slave_parallel_mode; |
| 8 |
SET GLOBAL slave_parallel_mode=aggressive; |
| 9 |
SET @old_dbug= @@GLOBAL.debug_dbug; |
| 10 |
CHANGE MASTER TO master_use_gtid=slave_pos; |
| 11 |
include/start_slave.inc |
| 12 |
*** MDEV-31509: Lost data with FTWRL and STOP SLAVE |
| 13 |
connection master; |
| 14 |
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; |
| 15 |
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB; |
| 16 |
CREATE TABLE t2 (a INT PRIMARY KEY, b INT) ENGINE=MyISAM; |
| 17 |
INSERT INTO t1 VALUES (0,0); |
| 18 |
INSERT INTO t2 VALUES (0,0); |
| 19 |
include/save_master_gtid.inc |
| 20 |
connection slave; |
| 21 |
include/sync_with_master_gtid.inc |
| 22 |
connection slave; |
| 23 |
*** Arrange for T1 to delay before entering GCO wait. |
| 24 |
SET GLOBAL debug_dbug="+d,gco_wait_delay_gtid_0_x_99"; |
| 25 |
*** Arrange for T2 to wait for FTWRL to start. |
| 26 |
SET GLOBAL debug_dbug="+d,hold_worker_on_schedule"; |
| 27 |
*** Arrange for T2 to delay wakeup from FTWRL pause. |
| 28 |
SET GLOBAL debug_dbug="+d,delay_ftwrl_wait_gtid_0_x_100"; |
| 29 |
connection master; |
| 30 |
*** Event group T1 |
| 31 |
SET SESSION gtid_seq_no=99; |
| 32 |
INSERT INTO t1 VALUES (1,1); |
| 33 |
connection slave; |
| 34 |
*** 1a. Wait for T1 to be queued. |
| 35 |
SET debug_sync="now WAIT_FOR gco_wait_paused"; |
| 36 |
connection master; |
| 37 |
*** Event group T2 |
| 38 |
SET SESSION gtid_seq_no=100; |
| 39 |
INSERT INTO t2 VALUES (2,2); |
| 40 |
connection slave; |
| 41 |
*** 1b. Wait for T2 to be queued. |
| 42 |
SET debug_sync= "now WAIT_FOR reached_pause"; |
| 43 |
connection slave1; |
| 44 |
*** 2. Run FTWRL |
| 45 |
SET GLOBAL debug_dbug= "+d,pause_for_ftwrl_wait"; |
| 46 |
FLUSH TABLES WITH READ LOCK; |
| 47 |
connection slave; |
| 48 |
SET debug_sync= "now WAIT_FOR pause_ftwrl_waiting"; |
| 49 |
*** 3. Wait for T2 to be waiting for FTWRL pause |
| 50 |
SET debug_sync= "now SIGNAL continue_worker"; |
| 51 |
*** 4. FTWRL completes, UNLOCK TABLES. |
| 52 |
SET debug_sync="now SIGNAL pause_ftwrl_cont"; |
| 53 |
connection slave1; |
| 54 |
UNLOCK TABLES; |
| 55 |
connection slave; |
| 56 |
*** T2 is now ready to proceed after FTWRL pause, but did not wake up yet. |
| 57 |
SET debug_sync="now WAIT_FOR pause_wait_started"; |
| 58 |
*** 5. STOP SLAVE is run. |
| 59 |
connection slave1; |
| 60 |
SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; |
| 61 |
STOP SLAVE; |
| 62 |
connection slave; |
| 63 |
SET debug_sync="now WAIT_FOR wait_for_done_waiting"; |
| 64 |
*** 5. T2 wakes up after FTWRL pause, reaches wait_for_prior_commit(). |
| 65 |
SET debug_sync="now SIGNAL pause_wait_continue"; |
| 66 |
*** 6. T1 starts. |
| 67 |
SET debug_sync="now SIGNAL gco_wait_cont"; |
| 68 |
connection slave1; |
| 69 |
connection slave; |
| 70 |
include/wait_for_slave_to_stop.inc |
| 71 |
connection master; |
| 72 |
SELECT * FROM t1 ORDER BY a; |
| 73 |
a b |
| 74 |
0 0 |
| 75 |
1 1 |
| 76 |
SELECT * FROM t2 ORDER BY a; |
| 77 |
a b |
| 78 |
0 0 |
| 79 |
2 2 |
| 80 |
include/save_master_gtid.inc |
| 81 |
connection slave; |
| 82 |
include/start_slave.inc |
| 83 |
include/sync_with_master_gtid.inc |
| 84 |
SELECT @@GLOBAL.gtid_slave_pos; |
| 85 |
@@GLOBAL.gtid_slave_pos |
| 86 |
0-1-100 |
| 87 |
SELECT * FROM t1 ORDER BY a; |
| 88 |
a b |
| 89 |
0 0 |
| 90 |
1 1 |
| 91 |
SELECT * FROM t2 ORDER BY a; |
| 92 |
a b |
| 93 |
0 0 |
| 94 |
2 2 |
| 95 |
*** Clean up. |
| 96 |
connection slave; |
| 97 |
include/stop_slave.inc |
| 98 |
SET DEBUG_SYNC= "RESET"; |
| 99 |
SET GLOBAL slave_parallel_threads= @old_parallel_threads; |
| 100 |
SET GLOBAL slave_parallel_mode= @old_parallel_mode; |
| 101 |
SET GLOBAL debug_dbug=@old_dbug; |
| 102 |
include/start_slave.inc |
| 103 |
connection master; |
| 104 |
DROP TABLE t1, t2; |
| 105 |
include/rpl_end.inc |