Skip to content

Commit

Permalink
fix binlog_xa_recover test
Browse files Browse the repository at this point in the history
1. wait for the binlog thread to reach the certain state, don't use
   a debug_sync that's incorrectly placed to detect the state
2. no need to do a (non-deterministic) `show binlog events` to verify
   what is guaranteed by the directly preceding line
  • Loading branch information
vuvova committed Feb 22, 2021
1 parent bb98c6b commit 3c02148
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 42 deletions.
17 changes: 0 additions & 17 deletions mysql-test/suite/binlog/r/binlog_xa_recover.result
Original file line number Diff line number Diff line change
Expand Up @@ -146,29 +146,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */
SET DEBUG_SYNC= "now SIGNAL con10_cont";
connection con10;
connection default;
SET @old_dbug= @@global.DEBUG_DBUG;
SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
SET DEBUG_SYNC= "now SIGNAL con12_cont";
connection con12;
connection default;
SET GLOBAL debug_dbug= @old_dbug;
SET DEBUG_SYNC= "now SIGNAL con11_cont";
connection con11;
connection default;
Checking that master-bin.000004 is the last binlog checkpoint
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
master-bin.000004 # Gtid_list # # [#-#-#]
master-bin.000004 # Binlog_checkpoint # # master-bin.000001
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL)
master-bin.000004 # Table_map # # table_id: # (test.t1)
master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000004 # Xid # # COMMIT /* XID */
master-bin.000004 # Binlog_checkpoint # # master-bin.000002
master-bin.000004 # Binlog_checkpoint # # master-bin.000004
Now crash the server
SET SESSION debug_dbug="+d,crash_commit_after_log";
INSERT INTO t1 VALUES (14, NULL);
Expand Down
10 changes: 3 additions & 7 deletions mysql-test/suite/binlog/t/binlog_xa_recover.test
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,13 @@ connection default;

# We need to sync the test case with the background processing of the
# commit checkpoint, otherwise we get nondeterministic results.
SET @old_dbug= @@global.DEBUG_DBUG;
SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
let $wait_condition= select count(*) = 1 from performance_schema.threads where processlist_state = "Waiting for background binlog tasks";
--source include/wait_condition.inc

SET DEBUG_SYNC= "now SIGNAL con12_cont";
connection con12;
reap;
connection default;
SET GLOBAL debug_dbug= @old_dbug;

SET DEBUG_SYNC= "now SIGNAL con11_cont";
connection con11;
Expand All @@ -199,9 +198,6 @@ connection default;
--let $condition= = "master-bin.000004"
--source include/wait_show_condition.inc

--echo Checking that master-bin.000004 is the last binlog checkpoint
--source include/show_binlog_events.inc

--echo Now crash the server
# It is not too easy to test XA recovery, as it runs early during server
# startup, before any connections can be made.
Expand Down
18 changes: 0 additions & 18 deletions mysql-test/suite/binlog_encryption/binlog_xa_recover.result
Original file line number Diff line number Diff line change
Expand Up @@ -151,30 +151,12 @@ master-bin.000004 # Xid # # COMMIT /* XID */
SET DEBUG_SYNC= "now SIGNAL con10_cont";
connection con10;
connection default;
SET @old_dbug= @@global.DEBUG_DBUG;
SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed";
SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed";
SET DEBUG_SYNC= "now SIGNAL con12_cont";
connection con12;
connection default;
SET GLOBAL debug_dbug= @old_dbug;
SET DEBUG_SYNC= "now SIGNAL con11_cont";
connection con11;
connection default;
Checking that master-bin.000004 is the last binlog checkpoint
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
master-bin.000004 # Start_encryption # #
master-bin.000004 # Gtid_list # # [#-#-#]
master-bin.000004 # Binlog_checkpoint # # master-bin.000001
master-bin.000004 # Gtid # # BEGIN GTID #-#-#
master-bin.000004 # Annotate_rows # # INSERT INTO t1 VALUES (13, NULL)
master-bin.000004 # Table_map # # table_id: # (test.t1)
master-bin.000004 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000004 # Xid # # COMMIT /* XID */
master-bin.000004 # Binlog_checkpoint # # master-bin.000002
master-bin.000004 # Binlog_checkpoint # # master-bin.000004
Now crash the server
SET SESSION debug_dbug="+d,crash_commit_after_log";
INSERT INTO t1 VALUES (14, NULL);
Expand Down

0 comments on commit 3c02148

Please sign in to comment.