mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-181: XID crash recovery across binlog boundaries
Keep track of how many pending XIDs (transactions that are prepared in storage engine and written into binlog, but not yet durably committed on disk in the engine) there are in each binlog. When the count of one binlog drops to zero, write a new binlog checkpoint event, telling which is the oldest binlog with pending XIDs. When doing XA recovery after a crash, check the last binlog checkpoint event, and scan all binlog files from that point onwards for XIDs that must be committed if found in prepared state inside engine. Remove the code in binlog rotation that waits for all prepared XIDs to be committed before writing a new binlog file (this is no longer necessary when recovery can scan multiple binlog files).
This commit is contained in:
@ -332,12 +332,12 @@ a b
|
||||
2 1
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
SHOW BINLOG EVENTS LIMIT 6,3;
|
||||
SHOW BINLOG EVENTS LIMIT 7,3;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 663 Query 1 731 BEGIN
|
||||
master-bin.000001 731 Query 1 828 use `test`; INSERT INTO t2 VALUES (1,0), (2,0)
|
||||
master-bin.000001 828 Xid 1 855 COMMIT /* XID */
|
||||
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=855;
|
||||
master-bin.000001 704 Query 1 772 BEGIN
|
||||
master-bin.000001 772 Query 1 869 use `test`; INSERT INTO t2 VALUES (1,0), (2,0)
|
||||
master-bin.000001 869 Xid 1 896 COMMIT /* XID */
|
||||
-- CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=896;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a
|
||||
1
|
||||
|
Reference in New Issue
Block a user