mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-28461 semisync-slave server recovery fails to rollback prepared transaction
that is not in binlog. Post-crash recovery of --rpl-semi-sync-slave-enabled server failed to recognize a transaction in-doubt that needed rolled back. A prepared-but-not-in-binlog transaction gets committed instead to possibly create inconsistency with a master (e.g the way it was observed in the bug report). The semisync recovery is corrected now with initializing binlog coordinates of any transaction in-doubt to the maximum offset which is unreachable. In effect when a prepared transaction that is not found in binlog it will be decided to rollback because it's guaranteed to reside in a truncated tail area of binlog. Mtr tests are reinforced to cover the described scenario.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
connect(master1,localhost,root,,);
|
||||
connect(master2,localhost,root,,);
|
||||
connect(master3,localhost,root,,);
|
||||
connect(master4,localhost,root,,);
|
||||
|
||||
--connection default
|
||||
|
||||
@@ -22,16 +23,26 @@ SET DEBUG_SYNC= "commit_before_get_LOCK_after_binlog_sync SIGNAL master2_ready";
|
||||
SET DEBUG_SYNC= "now WAIT_FOR master2_ready";
|
||||
SELECT @@global.gtid_binlog_pos as 'Before the crash';
|
||||
|
||||
--connection master4
|
||||
# Simulate prepared & not-logged trx; it will never recover.
|
||||
SET DEBUG_SYNC= "ha_commit_trans_before_log_and_order SIGNAL master4_ready WAIT_FOR signal_never_arrives";
|
||||
--send INSERT INTO t4 VALUES (13)
|
||||
|
||||
--connection master3
|
||||
SET DEBUG_SYNC= "now WAIT_FOR master4_ready";
|
||||
SELECT @@global.gtid_binlog_pos as 'Before the crash and never logged trx';
|
||||
|
||||
--connection default
|
||||
--source include/kill_mysqld.inc
|
||||
--disconnect master1
|
||||
--disconnect master2
|
||||
--disconnect master3
|
||||
--disconnect master4
|
||||
|
||||
#
|
||||
# Server restart
|
||||
#
|
||||
--let $restart_parameters= --rpl-semi-sync-slave-enabled=1 --sync-binlog=1
|
||||
--let $restart_parameters= --rpl-semi-sync-slave-enabled=1 --sync-binlog=1 --log-warnings=3
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
# Check error log for a successful truncate message.
|
||||
@@ -49,6 +60,8 @@ SELECT @@global.gtid_binlog_pos as 'Before the crash';
|
||||
SELECT @@global.gtid_binlog_pos as 'After the crash';
|
||||
--echo "One row should be present in table 't'"
|
||||
SELECT * FROM t;
|
||||
--echo "No row should be present in table 't4'"
|
||||
SELECT * FROM t4;
|
||||
|
||||
# prepare binlog file index for the next test
|
||||
--inc $binlog_file_index
|
||||
|
Reference in New Issue
Block a user