mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave
The replication relay log position was sometimes updated incorrectly at the end of a transaction in parallel replication. This happened because the relay log file name was taken from the current Relay_log_info (SQL driver thread), not the correct value for the transaction in question. The result was that if a transaction was applied while the SQL driver thread was at least one relay log file ahead, _and_ the SQL thread was subsequently stopped before applying any events from the most recent relay log file, then the relay log position would be incorrect - wrong relay log file name. Thus, when the slave was started again, usually a relay log read error would result, or in rare cases, if the position happened to be readable, the slave might even skip arbitrary amounts of events. In GTID mode, the relay log position is reset when both slave threads are restarted, so this bug would only be seen in non-GTID mode, or in GTID mode when only the SQL thread, not the IO thread, was stopped.
This commit is contained in:
@@ -972,6 +972,54 @@ SET GLOBAL binlog_format= @old_format;
|
||||
SET GLOBAL slave_parallel_threads=0;
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
include/start_slave.inc
|
||||
*** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave ***
|
||||
INSERT INTO t2 VALUES (40);
|
||||
include/stop_slave.inc
|
||||
CHANGE MASTER TO master_use_gtid=no;
|
||||
SET @old_dbug= @@GLOBAL.debug_dbug;
|
||||
SET GLOBAL debug_dbug="+d,rpl_parallel_scheduled_gtid_0_x_100";
|
||||
SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger";
|
||||
SET GLOBAL slave_parallel_threads=0;
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
INSERT INTO t2 VALUES (41);
|
||||
INSERT INTO t2 VALUES (42);
|
||||
DELETE FROM t2 WHERE a=40;
|
||||
INSERT INTO t2 VALUES (43);
|
||||
INSERT INTO t2 VALUES (44);
|
||||
FLUSH LOGS;
|
||||
INSERT INTO t2 VALUES (45);
|
||||
SET gtid_seq_no=100;
|
||||
INSERT INTO t2 VALUES (46);
|
||||
BEGIN;
|
||||
SELECT * FROM t2 WHERE a=40 FOR UPDATE;
|
||||
a
|
||||
40
|
||||
include/start_slave.inc
|
||||
SET debug_sync= 'now WAIT_FOR scheduled_gtid_0_x_100';
|
||||
STOP SLAVE;
|
||||
SET debug_sync= 'now WAIT_FOR wait_for_done_waiting';
|
||||
ROLLBACK;
|
||||
include/wait_for_slave_sql_to_stop.inc
|
||||
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
|
||||
a
|
||||
41
|
||||
42
|
||||
include/start_slave.inc
|
||||
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
|
||||
a
|
||||
41
|
||||
42
|
||||
43
|
||||
44
|
||||
45
|
||||
46
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL debug_dbug=@old_dbug;
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
SET GLOBAL slave_parallel_threads=0;
|
||||
SET GLOBAL slave_parallel_threads=10;
|
||||
CHANGE MASTER TO master_use_gtid=slave_pos;
|
||||
include/start_slave.inc
|
||||
include/stop_slave.inc
|
||||
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
|
||||
include/start_slave.inc
|
||||
|
Reference in New Issue
Block a user