Details
-
Bug
-
Status: In Progress (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.6, 10.11, 11.4, 11.8
-
None
-
Unexpected results
-
Q4/2025 Server Maintenance
Description
When one (Trx1) that holds the record lock rolls back so the other one (Trx2) proceeds to INSERT successfully they could be logged
in reverse to their completion order, that is Trx2 (commits), Trx1 (rolls back) sequence in binlog provided some set of conditions hold.
The conditions make it possible (and legally) for Trx1 get into binlog even though it rolls back.
Here is a script to reproduce such binlog trace.
--source include/have_innodb.inc
|
--source include/have_binlog_format_mixed.inc
|
|
create table t1 (a int primary key, b text) engine=innodb; |
|
connect(trx1_rollback,localhost,root,,); |
CREATE TABLE t_x (a int) engine=MEMORY; |
|
--let $master_file= query_get_value(SHOW MASTER STATUS, File, 1)
|
--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
|
SET binlog_format=row; |
CREATE TEMPORARY TABLE tt_tmp ( id INT ) ENGINE = Memory; |
BEGIN; |
insert into t_x values (1); |
drop temporary table tt_tmp; |
insert into t1 values (99,1); |
|
SET DEBUG_SYNC= 'reset'; |
SET DEBUG_SYNC= "before_group_commit_queue SIGNAL trx1_parked_starts_waiting WAIT_FOR trx1_may_go_on"; |
|
--send ROLLBACK
|
|
# trx2_commit
|
connection default; |
insert into t1 values (99,2); |
select * from t1; |
|
SET DEBUG_SYNC= "now SIGNAL trx1_may_go_on"; |
|
--echo # Prove the logging order is Trx1, Trx2
|
--source include/show_binlog_events.inc
|
|
drop table t_x, t1; |
disconnect trx1_rollback;
|
|
--echo # end of the test
|
|
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
master-bin.000001 # Annotate_rows # # insert into t_x values (1)
|
master-bin.000001 # Table_map # # table_id: # (test.t_x)
|
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Query # # COMMIT
|
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
master-bin.000001 # Query # # use `test`; insert into t1 values (99,2)
|
master-bin.000001 # Xid # # COMMIT /* XID */
|
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
master-bin.000001 # Annotate_rows # # insert into t1 values (99,1)
|
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
master-bin.000001 # Query # # ROLLBACK
|