| 1 |
SET @old_max_binlog_size= @@global.max_binlog_size; |
| 2 |
SET GLOBAL max_binlog_size= 4096; |
| 3 |
SET @old_innodb_flush_log_at_trx_commit= @@global.innodb_flush_log_at_trx_commit; |
| 4 |
SET GLOBAL innodb_flush_log_at_trx_commit= 1; |
| 5 |
RESET MASTER; |
| 6 |
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; |
| 7 |
CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Myisam; |
| 8 |
*** Test that RESET MASTER waits for pending commit checkpoints to complete. |
| 9 |
connect con1,localhost,root,,; |
| 10 |
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_go"; |
| 11 |
INSERT INTO t1 VALUES (1, REPEAT("x", 4100)); |
| 12 |
connection default; |
| 13 |
SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; |
| 14 |
INSERT INTO t2 VALUES (1, REPEAT("x", 4100)); |
| 15 |
INSERT INTO t2 VALUES (2, REPEAT("x", 4100)); |
| 16 |
show binary logs; |
| 17 |
Log_name File_size |
| 18 |
master-bin.000001 # |
| 19 |
master-bin.000002 # |
| 20 |
master-bin.000003 # |
| 21 |
master-bin.000004 # |
| 22 |
include/show_binlog_events.inc |
| 23 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 24 |
master-bin.000004 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 25 |
master-bin.000004 # Gtid_list # # [#-#-#] |
| 26 |
master-bin.000004 # Binlog_checkpoint # # master-bin.000001 |
| 27 |
SET DEBUG_SYNC= "execute_command_after_close_tables SIGNAL reset_master_done"; |
| 28 |
RESET MASTER; |
| 29 |
connect con2,localhost,root,,; |
| 30 |
This will timeout, as RESET MASTER is blocked |
| 31 |
SET DEBUG_SYNC= "now WAIT_FOR reset_master_done TIMEOUT 1"; |
| 32 |
Warnings: |
| 33 |
Warning 1639 debug sync point wait timed out |
| 34 |
SET DEBUG_SYNC= "now SIGNAL con1_go"; |
| 35 |
connection con1; |
| 36 |
connection default; |
| 37 |
show binary logs; |
| 38 |
Log_name File_size |
| 39 |
master-bin.000001 # |
| 40 |
include/show_binlog_events.inc |
| 41 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 42 |
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 43 |
master-bin.000001 # Gtid_list # # [] |
| 44 |
master-bin.000001 # Binlog_checkpoint # # master-bin.000001 |
| 45 |
*** Test that binlog N is active, and commit checkpoint for (N-1) is |
| 46 |
*** done while there is still a pending commit checkpoint for (N-2). |
| 47 |
connection con1; |
| 48 |
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con1_ready WAIT_FOR con1_continue"; |
| 49 |
INSERT INTO t1 VALUES (20, REPEAT("x", 4100)); |
| 50 |
connection default; |
| 51 |
SET DEBUG_SYNC= "now WAIT_FOR con1_ready"; |
| 52 |
connection con2; |
| 53 |
SET DEBUG_SYNC= "commit_after_group_release_commit_ordered SIGNAL con2_ready WAIT_FOR con2_continue"; |
| 54 |
INSERT INTO t1 VALUES (21, REPEAT("x", 4100)); |
| 55 |
connection default; |
| 56 |
SET DEBUG_SYNC= "now WAIT_FOR con2_ready"; |
| 57 |
show binary logs; |
| 58 |
Log_name File_size |
| 59 |
master-bin.000001 # |
| 60 |
master-bin.000002 # |
| 61 |
master-bin.000003 # |
| 62 |
include/show_binlog_events.inc |
| 63 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 64 |
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 65 |
master-bin.000001 # Gtid_list # # [] |
| 66 |
master-bin.000001 # Binlog_checkpoint # # master-bin.000001 |
| 67 |
master-bin.000001 # Gtid # # BEGIN GTID #-#-# |
| 68 |
master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (20, REPEAT("x", 4100)) |
| 69 |
master-bin.000001 # Table_map # # table_id: # (test.t1) |
| 70 |
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 71 |
master-bin.000001 # Xid # # COMMIT /* XID */ |
| 72 |
master-bin.000001 # Rotate # # master-bin.000002;pos=POS |
| 73 |
include/show_binlog_events.inc |
| 74 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 75 |
master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 76 |
master-bin.000002 # Gtid_list # # [#-#-#] |
| 77 |
master-bin.000002 # Binlog_checkpoint # # master-bin.000001 |
| 78 |
master-bin.000002 # Gtid # # BEGIN GTID #-#-# |
| 79 |
master-bin.000002 # Annotate_rows # # INSERT INTO t1 VALUES (21, REPEAT("x", 4100)) |
| 80 |
master-bin.000002 # Table_map # # table_id: # (test.t1) |
| 81 |
master-bin.000002 # Write_rows_v1 # # table_id: # flags: STMT_END_F |
| 82 |
master-bin.000002 # Xid # # COMMIT /* XID */ |
| 83 |
master-bin.000002 # Rotate # # master-bin.000003;pos=POS |
| 84 |
include/show_binlog_events.inc |
| 85 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 86 |
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 87 |
master-bin.000003 # Gtid_list # # [#-#-#] |
| 88 |
master-bin.000003 # Binlog_checkpoint # # master-bin.000001 |
| 89 |
SET DEBUG_SYNC= "RESET"; |
| 90 |
SET @old_dbug= @@global.DEBUG_DBUG; |
| 91 |
SET GLOBAL debug_dbug="+d,binlog_background_checkpoint_processed"; |
| 92 |
SET DEBUG_SYNC= "now SIGNAL con2_continue"; |
| 93 |
connection con2; |
| 94 |
connection default; |
| 95 |
con1 is still pending, no new binlog checkpoint should have been logged. |
| 96 |
SET DEBUG_SYNC= "now WAIT_FOR binlog_background_checkpoint_processed"; |
| 97 |
SET GLOBAL debug_dbug= @old_dbug; |
| 98 |
SET DEBUG_SYNC= "RESET"; |
| 99 |
include/show_binlog_events.inc |
| 100 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 101 |
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 102 |
master-bin.000003 # Gtid_list # # [#-#-#] |
| 103 |
master-bin.000003 # Binlog_checkpoint # # master-bin.000001 |
| 104 |
SET DEBUG_SYNC= "now SIGNAL con1_continue"; |
| 105 |
connection con1; |
| 106 |
connection default; |
| 107 |
No commit checkpoints are pending, a new binlog checkpoint should have been logged. |
| 108 |
include/show_binlog_events.inc |
| 109 |
Log_name Pos Event_type Server_id End_log_pos Info |
| 110 |
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION |
| 111 |
master-bin.000003 # Gtid_list # # [#-#-#] |
| 112 |
master-bin.000003 # Binlog_checkpoint # # master-bin.000001 |
| 113 |
master-bin.000003 # Binlog_checkpoint # # master-bin.000003 |
| 114 |
*** MDEV-4322: Broken XID counting during binlog rotation *** |
| 115 |
connection default; |
| 116 |
SET @old_dbug= @@global.DEBUG_DBUG; |
| 117 |
SET GLOBAL debug_dbug="+d,inject_binlog_background_thread_before_mark_xid_done"; |
| 118 |
FLUSH LOGS; |
| 119 |
INSERT INTO t1 VALUES (30, REPEAT("x", 4100)); |
| 120 |
SET DEBUG_SYNC= "now WAIT_FOR injected_binlog_background_thread"; |
| 121 |
SET GLOBAL debug_dbug= @old_dbug; |
| 122 |
INSERT INTO t1 VALUES (31, REPEAT("x", 4100)); |
| 123 |
show binary logs; |
| 124 |
Log_name File_size |
| 125 |
master-bin.000001 # |
| 126 |
master-bin.000002 # |
| 127 |
master-bin.000003 # |
| 128 |
master-bin.000004 # |
| 129 |
master-bin.000005 # |
| 130 |
master-bin.000006 # |
| 131 |
SET debug_sync = 'reset'; |
| 132 |
SET GLOBAL max_binlog_size= @old_max_binlog_size; |
| 133 |
SET GLOBAL innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit; |
| 134 |
# restart |
| 135 |
*** MDEV-7402: 'reset master' hangs, waits for signalled COND_xid_list *** |
| 136 |
connect con3,localhost,root,,; |
| 137 |
SET debug_sync="reset_logs_after_set_reset_master_pending SIGNAL reset_master_ready WAIT_FOR reset_master_cont"; |
| 138 |
RESET MASTER; |
| 139 |
connection default; |
| 140 |
SET @old_dbug= @@global.DEBUG_DBUG; |
| 141 |
SET GLOBAL debug_dbug="+d,inject_binlog_background_thread_before_mark_xid_done"; |
| 142 |
SET debug_sync="now WAIT_FOR reset_master_ready"; |
| 143 |
RESET MASTER; |
| 144 |
SET debug_sync="now WAIT_FOR injected_binlog_background_thread"; |
| 145 |
SET GLOBAL debug_dbug=@old_dbug; |
| 146 |
SET debug_sync="now SIGNAL reset_master_cont"; |
| 147 |
connection con3; |
| 148 |
connection default; |
| 149 |
SET debug_sync = 'reset'; |
| 150 |
*** MDEV-24660: MYSQL_BIN_LOG::cleanup(): Assertion `b->xid_count == 0' failed in MYSQL_BIN_LOG::cleanup |
| 151 |
SET @old_max_binlog_size= @@global.max_binlog_size; |
| 152 |
SET GLOBAL max_binlog_size= 4096; |
| 153 |
connect con_24660,localhost,root,,; |
| 154 |
FLUSH LOGS; |
| 155 |
SET @@session.binlog_format = STATEMENT; |
| 156 |
CREATE TABLE tm (a INT) ENGINE = myisam; |
| 157 |
call mtr.add_suppression("Table './test/tm' is marked as crashed"); |
| 158 |
call mtr.add_suppression("Checking table"); |
| 159 |
XA START 'xa1'; |
| 160 |
INSERT INTO t1 VALUES (2, 1); |
| 161 |
INSERT INTO tm SET a = 1; |
| 162 |
XA END 'xa1'; |
| 163 |
connection default; |
| 164 |
SET GLOBAL debug_dbug="+d,only_kill_system_threads_no_loop"; |
| 165 |
# restart |
| 166 |
** Proof of shutdown caused ROLLBACK-completed transaction |
| 167 |
# MYSQL_BINLOG datadir/binlog_file --result-file=assert_file |
| 168 |
include/assert_grep.inc [No XA statements should be written into the binary log] |
| 169 |
include/assert_grep.inc [The transaction should be rolled back] |
| 170 |
SELECT * FROM tm; |
| 171 |
a |
| 172 |
1 |
| 173 |
SELECT * FROM t1 WHERE a = 3; |
| 174 |
a b |
| 175 |
DROP TABLE t1, t2, tm; |