mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 14:02:32 +01:00
0697ee265f
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).
32 lines
897 B
Text
32 lines
897 B
Text
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
|
|
SET binlog_format= mixed;
|
|
RESET MASTER;
|
|
XA START 'xatest';
|
|
INSERT INTO t1 VALUES (1);
|
|
XA END 'xatest';
|
|
XA PREPARE 'xatest';
|
|
XA COMMIT 'xatest';
|
|
XA START 'xatest';
|
|
INSERT INTO t1 VALUES (2);
|
|
XA END 'xatest';
|
|
XA COMMIT 'xatest' ONE PHASE;
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES (3);
|
|
COMMIT;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a
|
|
1
|
|
2
|
|
3
|
|
SHOW BINLOG EVENTS LIMIT 2,9;
|
|
Log_name Pos Event_type Server_id End_log_pos Info
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
|
|
master-bin.000001 # Query 1 # COMMIT
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (2)
|
|
master-bin.000001 # Query 1 # COMMIT
|
|
master-bin.000001 # Query 1 # BEGIN
|
|
master-bin.000001 # Query 1 # use `test`; INSERT INTO t1 VALUES (3)
|
|
master-bin.000001 # Xid 1 # COMMIT /* xid=XX */
|
|
DROP TABLE t1;
|