mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02: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:
parent
9fe317ffd6
commit
0697ee265f
53 changed files with 1173 additions and 220 deletions
|
|
@ -16,6 +16,7 @@ a
|
|||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
BINLOG POS Format_desc 1 ENDPOS Server ver: #, Binlog ver: #
|
||||
BINLOG POS Binlog_checkpoint 1 ENDPOS master-bin.000001
|
||||
BINLOG POS Query 1 ENDPOS use `test`; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb
|
||||
BINLOG POS Query 1 ENDPOS BEGIN
|
||||
BINLOG POS Query 1 ENDPOS use `test`; INSERT INTO t1 VALUES(0)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#####################################################################################
|
||||
show binlog events in 'master-bin.000001' from <start_pos>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
|
||||
master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
|
||||
master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test2
|
||||
master-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test3
|
||||
|
|
@ -67,6 +68,8 @@ DELIMITER /*!*/;
|
|||
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=#/*!*/;
|
||||
|
|
@ -293,6 +296,8 @@ DELIMITER /*!*/;
|
|||
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=#/*!*/;
|
||||
|
|
@ -437,6 +442,8 @@ DELIMITER /*!*/;
|
|||
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=#/*!*/;
|
||||
|
|
@ -653,6 +660,8 @@ DELIMITER /*!*/;
|
|||
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=#/*!*/;
|
||||
|
|
@ -879,6 +888,8 @@ DELIMITER /*!*/;
|
|||
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=#/*!*/;
|
||||
|
|
@ -1023,6 +1034,8 @@ DELIMITER /*!*/;
|
|||
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
|
||||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
SET TIMESTAMP=1000000000/*!*/;
|
||||
SET @@session.pseudo_thread_id=#/*!*/;
|
||||
|
|
|
|||
|
|
@ -728,6 +728,7 @@ BINLOG '
|
|||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
# # Format_desc 1 # Server ver: #, Binlog ver: #
|
||||
# # Binlog_checkpoint 1 # master-bin.000001
|
||||
# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
|
||||
# # Query 1 # BEGIN
|
||||
# # Table_map 1 # table_id: # (test.t1)
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ DELIMITER /*!*/;
|
|||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
|
||||
# at #
|
||||
# at #
|
||||
use `new_test1`/*!*/;
|
||||
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
|
|
@ -228,6 +230,8 @@ DELIMITER /*!*/;
|
|||
# at #
|
||||
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
|
||||
ROLLBACK/*!*/;
|
||||
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
|
||||
# at #
|
||||
# at #
|
||||
use `new_test1`/*!*/;
|
||||
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ select @@server_id;
|
|||
1
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
|
||||
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
|
||||
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
|
||||
set global server_id=2;
|
||||
|
|
@ -16,6 +17,7 @@ select @@server_id;
|
|||
2
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
|
||||
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
|
||||
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query 2 # use `test`; create table t2 (b int)
|
||||
|
|
@ -26,6 +28,7 @@ select @@server_id;
|
|||
3
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
|
||||
master-bin.000001 # Query 1 # use `test`; DROP TABLE IF EXISTS `t1`,`t2`,`t3` /* generated by server */
|
||||
master-bin.000001 # Query 1 # use `test`; create table t1 (a int)
|
||||
master-bin.000001 # Query 2 # use `test`; create table t2 (b int)
|
||||
|
|
|
|||
|
|
@ -521,6 +521,7 @@ BINLOG '
|
|||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
# # Format_desc 1 # Server ver: #, Binlog ver: #
|
||||
# # Binlog_checkpoint 1 # master-bin.000001
|
||||
# # Query 1 # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY)
|
||||
# # Query 1 # BEGIN
|
||||
# # Query 1 # use `test`; INSERT INTO t1 VALUES (1)
|
||||
|
|
|
|||
|
|
@ -175,6 +175,7 @@ set insert_id= 5;
|
|||
insert into t1 values (55), (NULL);
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
|
||||
master-bin.000001 # Query 1 # use `test`; create table t1 (a int auto_increment, primary key (a)) engine=blackhole
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Intvar 1 # INSERT_ID=1
|
||||
|
|
|
|||
175
mysql-test/suite/binlog/r/binlog_xa_recover.result
Normal file
175
mysql-test/suite/binlog/r/binlog_xa_recover.result
Normal file
|
|
@ -0,0 +1,175 @@
|
|||
SET GLOBAL max_binlog_size= 4096;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Myisam;
|
||||
SET @@global.debug_dbug='+d,skip_commit_ordered';
|
||||
INSERT INTO t1 VALUES (0, REPEAT("x", 4100));
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con1_ready WAIT_FOR _ever";
|
||||
INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
||||
INSERT INTO t2 VALUES (1, "force binlog rotation");
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con2_ready WAIT_FOR _ever";
|
||||
INSERT INTO t1 VALUES (2, NULL);
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con3_ready WAIT_FOR _ever";
|
||||
INSERT INTO t1 VALUES (3, REPEAT("x", 4100));
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
|
||||
INSERT INTO t2 VALUES (2, "force binlog rotation");
|
||||
FLUSH TABLES t2;
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
master-bin.000001 #
|
||||
master-bin.000002 #
|
||||
master-bin.000003 #
|
||||
master-bin.000004 #
|
||||
show binlog events in 'master-bin.000001' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000001 # Binlog_checkpoint # # master-bin.000001
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Myisam
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Rotate # # master-bin.000002;pos=<binlog_start>
|
||||
show binlog events in 'master-bin.000002' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000002 # Binlog_checkpoint # # master-bin.000002
|
||||
master-bin.000002 # Query # # BEGIN
|
||||
master-bin.000002 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000002 # Xid # # COMMIT /* XID */
|
||||
master-bin.000002 # Query # # BEGIN
|
||||
master-bin.000002 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000002 # Query # # COMMIT
|
||||
master-bin.000002 # Rotate # # master-bin.000003;pos=<binlog_start>
|
||||
show binlog events in 'master-bin.000003' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000003 # Binlog_checkpoint # # master-bin.000002
|
||||
master-bin.000003 # Query # # BEGIN
|
||||
master-bin.000003 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000003 # Xid # # COMMIT /* XID */
|
||||
master-bin.000003 # Query # # BEGIN
|
||||
master-bin.000003 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000003 # Xid # # COMMIT /* XID */
|
||||
master-bin.000003 # Query # # BEGIN
|
||||
master-bin.000003 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000003 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000003 # Query # # COMMIT
|
||||
master-bin.000003 # Rotate # # master-bin.00000<binlog_start>;pos=<binlog_start>
|
||||
show binlog events in 'master-bin.00000<binlog_start>' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.00000<binlog_start> # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.00000<binlog_start> # Binlog_checkpoint # # master-bin.000002
|
||||
master-bin.00000<binlog_start> # Query # # use `test`; FLUSH TABLES t2
|
||||
We should see only one entry here, a=0:
|
||||
SELECT a FROM t1 ORDER BY a;
|
||||
a
|
||||
0
|
||||
PURGE BINARY LOGS TO "master-bin.000004";
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
master-bin.000002 #
|
||||
master-bin.000003 #
|
||||
master-bin.000004 #
|
||||
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
||||
INSERT INTO t1 VALUES (4, NULL);
|
||||
Got one of the listed errors
|
||||
SELECT a FROM t1 ORDER BY a;
|
||||
a
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
*** Test that RESET MASTER waits for pending XIDs to be unlogged.
|
||||
SET @old_max_binlog_size= @@global.max_binlog_size;
|
||||
SET GLOBAL max_binlog_size= 4096;
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con10_ready WAIT_FOR con10_go";
|
||||
INSERT INTO t1 VALUES (10, NULL);
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
|
||||
INSERT INTO t2 VALUES (10, REPEAT("x", 4100));
|
||||
INSERT INTO t2 VALUES (11, REPEAT("x", 4100));
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
master-bin.000002 #
|
||||
master-bin.000003 #
|
||||
master-bin.000004 #
|
||||
master-bin.000005 #
|
||||
master-bin.000006 #
|
||||
master-bin.000007 #
|
||||
SET DEBUG_SYNC= "execute_command_after_close_tables SIGNAL reset_master_done";
|
||||
RESET MASTER;
|
||||
This will timeout, as RESET MASTER is blocked
|
||||
SET DEBUG_SYNC= "now WAIT_FOR reset_master_done TIMEOUT 1";
|
||||
Warnings:
|
||||
Warning 1639 debug sync point wait timed out
|
||||
SET DEBUG_SYNC= "now SIGNAL con10_go";
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
master-bin.000001 #
|
||||
*** Test that binlog N is active, and last pending trx in (N-1) is
|
||||
unlogged while there is still a pending trx in (N-2).
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con10_ready WAIT_FOR con10_continue";
|
||||
INSERT INTO t1 VALUES (20, REPEAT("x", 4100));
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
|
||||
INSERT INTO t2 VALUES (3, "force binlog rotation");
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con11_ready WAIT_FOR con11_continue";
|
||||
INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con11_ready";
|
||||
INSERT INTO t2 VALUES (4, "force binlog rotation");
|
||||
show binary logs;
|
||||
Log_name File_size
|
||||
master-bin.000001 #
|
||||
master-bin.000002 #
|
||||
master-bin.000003 #
|
||||
show binlog events in 'master-bin.000001' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000001 # Binlog_checkpoint # # master-bin.000001
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Xid # # COMMIT /* XID */
|
||||
master-bin.000001 # Query # # BEGIN
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Rotate # # master-bin.000002;pos=<binlog_start>
|
||||
show binlog events in 'master-bin.000002' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000002 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000002 # Binlog_checkpoint # # master-bin.000001
|
||||
master-bin.000002 # Query # # BEGIN
|
||||
master-bin.000002 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000002 # Xid # # COMMIT /* XID */
|
||||
master-bin.000002 # Query # # BEGIN
|
||||
master-bin.000002 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000002 # Write_rows # # table_id: # flags: STMT_END_F
|
||||
master-bin.000002 # Query # # COMMIT
|
||||
master-bin.000002 # Rotate # # master-bin.000003;pos=<binlog_start>
|
||||
show binlog events in 'master-bin.000003' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
||||
SET DEBUG_SYNC= "now SIGNAL con11_continue";
|
||||
con10 is still pending, no new binlog checkpoint should have been logged.
|
||||
show binlog events in 'master-bin.000003' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
||||
SET DEBUG_SYNC= "now SIGNAL con10_continue";
|
||||
No XIDs are pending, a new binlog checkpoint should have been logged.
|
||||
show binlog events in 'master-bin.000003' from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
master-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
||||
master-bin.000003 # Binlog_checkpoint # # master-bin.000003
|
||||
DROP TABLE t1, t2;
|
||||
SET GLOBAL max_binlog_size= @old_max_binlog_size;
|
||||
|
|
@ -59,8 +59,8 @@ reap;
|
|||
let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
|
||||
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--let $binlog_killed_pos=query_get_value(SHOW BINLOG EVENTS, Pos, 4)
|
||||
--let $binlog_killed_end_log_pos=query_get_value(SHOW BINLOG EVENTS, End_log_pos, 4)
|
||||
--let $binlog_killed_pos=query_get_value(SHOW BINLOG EVENTS, Pos, 5)
|
||||
--let $binlog_killed_end_log_pos=query_get_value(SHOW BINLOG EVENTS, End_log_pos, 5)
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_killed_pos --stop-position=$binlog_killed_end_log_pos $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--disable_result_log
|
||||
|
|
@ -270,8 +270,8 @@ select * from t4 order by b /* must be (1,1), (1,2) */;
|
|||
select @b /* must be 1 at the end of a stmt calling bug27563() */;
|
||||
--echo must have the update query event on the 4th line
|
||||
source include/show_binlog_events.inc;
|
||||
--let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
|
||||
--let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 4)
|
||||
--let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, 5)
|
||||
--let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 5)
|
||||
|
||||
--echo *** a proof the query is binlogged with an error ***
|
||||
|
||||
|
|
@ -318,8 +318,8 @@ select count(*) from t4 /* must be 1 */;
|
|||
select @b /* must be 1 at the end of a stmt calling bug27563() */;
|
||||
--echo must have the delete query event on the 4th line
|
||||
source include/show_binlog_events.inc;
|
||||
--let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
|
||||
--let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 4)
|
||||
--let $binlog_killed_pos= query_get_value(SHOW BINLOG EVENTS, Pos, 5)
|
||||
--let $binlog_killed_end_log_pos= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 5)
|
||||
|
||||
# a proof the query is binlogged with an error
|
||||
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t2 /* will be "kil
|
|||
|
||||
|
||||
# a proof the query is binlogged with an error
|
||||
--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 3)
|
||||
--let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
|
||||
--let $binlog_load_data= query_get_value(SHOW BINLOG EVENTS, Pos, 4)
|
||||
--let $binlog_end= query_get_value(SHOW BINLOG EVENTS, Pos, 5)
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--exec $MYSQL_BINLOG --force-if-open --start-position=$binlog_load_data --stop-position=$binlog_end $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/binlog_killed_bug27571.binlog
|
||||
|
|
|
|||
1
mysql-test/suite/binlog/t/binlog_xa_recover-master.opt
Normal file
1
mysql-test/suite/binlog/t/binlog_xa_recover-master.opt
Normal file
|
|
@ -0,0 +1 @@
|
|||
--skip-stack-trace --skip-core-file
|
||||
174
mysql-test/suite/binlog/t/binlog_xa_recover.test
Normal file
174
mysql-test/suite/binlog/t/binlog_xa_recover.test
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
# Valgrind does not work well with test that crashes the server
|
||||
--source include/not_valgrind.inc
|
||||
|
||||
SET GLOBAL max_binlog_size= 4096;
|
||||
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
|
||||
CREATE TABLE t2 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Myisam;
|
||||
|
||||
# Transactions are not guaranteed stored durably on disk in the engine until
|
||||
# they are fsync()ed, which normally happens during commit(). But there is no
|
||||
# guarantee that they will _not_ be durable, in particular loosing results
|
||||
# of a write(2) system call normally requires a kernel crash (as opposed to
|
||||
# just mysqld crash), which is inconvenient to do in a test suite.
|
||||
# So instead we do an error insert to prevent commit_ordered() from being
|
||||
# called in the engine - so nothing will be written to disk at all, and crash
|
||||
# recovery is sure to be needed.
|
||||
SET @@global.debug_dbug='+d,skip_commit_ordered';
|
||||
|
||||
INSERT INTO t1 VALUES (0, REPEAT("x", 4100));
|
||||
|
||||
# Now start a bunch of transactions that span multiple binlog
|
||||
# files. Leave then in the state prepared-but-not-committed in the engine
|
||||
# and crash the server. Check that crash recovery is able to recover all
|
||||
# of them.
|
||||
|
||||
connect(con1,localhost,root,,);
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con1_ready WAIT_FOR _ever";
|
||||
send INSERT INTO t1 VALUES (1, REPEAT("x", 4100));
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
|
||||
INSERT INTO t2 VALUES (1, "force binlog rotation");
|
||||
|
||||
connect(con2,localhost,root,,);
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con2_ready WAIT_FOR _ever";
|
||||
send INSERT INTO t1 VALUES (2, NULL);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con2_ready";
|
||||
|
||||
connect(con3,localhost,root,,);
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con3_ready WAIT_FOR _ever";
|
||||
send INSERT INTO t1 VALUES (3, REPEAT("x", 4100));
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con3_ready";
|
||||
INSERT INTO t2 VALUES (2, "force binlog rotation");
|
||||
# So we won't get warnings about t2 being crashed.
|
||||
FLUSH TABLES t2;
|
||||
|
||||
# Check that everything is committed in binary log.
|
||||
--source include/show_binary_logs.inc
|
||||
--let $binlog_file= master-bin.000001
|
||||
--let $binlog_start= 4
|
||||
--source include/show_binlog_events.inc
|
||||
--let $binlog_file= master-bin.000002
|
||||
--source include/show_binlog_events.inc
|
||||
--let $binlog_file= master-bin.000003
|
||||
--source include/show_binlog_events.inc
|
||||
--let $binlog_file= master-bin.000004
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
# Check that transactions really are not yet committed in engine.
|
||||
# (This works because of debug_dbug='+d,skip_commit_ordered').
|
||||
--echo We should see only one entry here, a=0:
|
||||
SELECT a FROM t1 ORDER BY a;
|
||||
|
||||
|
||||
# Check that server will not purge too much.
|
||||
PURGE BINARY LOGS TO "master-bin.000004";
|
||||
--source include/show_binary_logs.inc
|
||||
|
||||
# Now crash the server with one more transaction in prepared state.
|
||||
system echo wait-binlog_xa_recover.test >> $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
|
||||
SET SESSION debug_dbug="+d,crash_commit_after_log";
|
||||
--error 2006,2013
|
||||
INSERT INTO t1 VALUES (4, NULL);
|
||||
|
||||
system echo restart-group_commit_binlog_pos.test >> $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
|
||||
|
||||
connection default;
|
||||
--enable_reconnect
|
||||
--source include/wait_until_connected_again.inc
|
||||
|
||||
# Check that all transactions are recovered.
|
||||
SELECT a FROM t1 ORDER BY a;
|
||||
|
||||
|
||||
--echo *** Test that RESET MASTER waits for pending XIDs to be unlogged.
|
||||
|
||||
SET @old_max_binlog_size= @@global.max_binlog_size;
|
||||
SET GLOBAL max_binlog_size= 4096;
|
||||
# con10 will hang with a pending XID, blocking RESET MASTER.
|
||||
connect(con10,localhost,root,,);
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con10_ready WAIT_FOR con10_go";
|
||||
send INSERT INTO t1 VALUES (10, NULL);
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
|
||||
# Let's add a few binlog rotations just for good measure.
|
||||
INSERT INTO t2 VALUES (10, REPEAT("x", 4100));
|
||||
INSERT INTO t2 VALUES (11, REPEAT("x", 4100));
|
||||
--source include/show_binary_logs.inc
|
||||
SET DEBUG_SYNC= "execute_command_after_close_tables SIGNAL reset_master_done";
|
||||
send RESET MASTER;
|
||||
|
||||
connect(con11,localhost,root,,);
|
||||
--echo This will timeout, as RESET MASTER is blocked
|
||||
SET DEBUG_SYNC= "now WAIT_FOR reset_master_done TIMEOUT 1";
|
||||
# Wake up transaction to allow RESET MASTER to complete.
|
||||
SET DEBUG_SYNC= "now SIGNAL con10_go";
|
||||
|
||||
connection con10;
|
||||
reap;
|
||||
|
||||
connection default;
|
||||
reap;
|
||||
--source include/show_binary_logs.inc
|
||||
|
||||
|
||||
--echo *** Test that binlog N is active, and last pending trx in (N-1) is
|
||||
--echo unlogged while there is still a pending trx in (N-2).
|
||||
|
||||
connection con10;
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con10_ready WAIT_FOR con10_continue";
|
||||
send INSERT INTO t1 VALUES (20, REPEAT("x", 4100));
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con10_ready";
|
||||
INSERT INTO t2 VALUES (3, "force binlog rotation");
|
||||
|
||||
connection con11;
|
||||
SET DEBUG_SYNC= "ha_commit_trans_after_log_and_order SIGNAL con11_ready WAIT_FOR con11_continue";
|
||||
send INSERT INTO t1 VALUES (21, REPEAT("x", 4100));
|
||||
|
||||
connection default;
|
||||
SET DEBUG_SYNC= "now WAIT_FOR con11_ready";
|
||||
INSERT INTO t2 VALUES (4, "force binlog rotation");
|
||||
--source include/show_binary_logs.inc
|
||||
--let $binlog_file= master-bin.000001
|
||||
--source include/show_binlog_events.inc
|
||||
--let $binlog_file= master-bin.000002
|
||||
--source include/show_binlog_events.inc
|
||||
--let $binlog_file= master-bin.000003
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
SET DEBUG_SYNC= "now SIGNAL con11_continue";
|
||||
|
||||
connection con11;
|
||||
reap;
|
||||
|
||||
connection default;
|
||||
--echo con10 is still pending, no new binlog checkpoint should have been logged.
|
||||
--let $binlog_file= master-bin.000003
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
SET DEBUG_SYNC= "now SIGNAL con10_continue";
|
||||
|
||||
connection con10;
|
||||
reap;
|
||||
|
||||
connection default;
|
||||
--echo No XIDs are pending, a new binlog checkpoint should have been logged.
|
||||
--let $binlog_file= master-bin.000003
|
||||
--source include/show_binlog_events.inc
|
||||
|
||||
|
||||
# Cleanup
|
||||
connection default;
|
||||
DROP TABLE t1, t2;
|
||||
SET GLOBAL max_binlog_size= @old_max_binlog_size;
|
||||
|
|
@ -3,11 +3,11 @@ RESET MASTER;
|
|||
CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
|
||||
SHOW MASTER STATUS;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 380
|
||||
master-bin.000001 421
|
||||
SHOW STATUS LIKE 'binlog_snapshot_%';
|
||||
Variable_name Value
|
||||
binlog_snapshot_file master-bin.000001
|
||||
binlog_snapshot_position 380
|
||||
binlog_snapshot_position 421
|
||||
BEGIN;
|
||||
INSERT INTO t1 VALUES (0, "");
|
||||
# Connection con1
|
||||
|
|
@ -38,10 +38,10 @@ a b
|
|||
SHOW STATUS LIKE 'binlog_snapshot_%';
|
||||
Variable_name Value
|
||||
binlog_snapshot_file master-bin.000001
|
||||
binlog_snapshot_position 904
|
||||
binlog_snapshot_position 945
|
||||
SHOW MASTER STATUS;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000001 1316
|
||||
master-bin.000001 1357
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
a
|
||||
2
|
||||
|
|
@ -60,44 +60,45 @@ a b
|
|||
SHOW STATUS LIKE 'binlog_snapshot_%';
|
||||
Variable_name Value
|
||||
binlog_snapshot_file master-bin.000001
|
||||
binlog_snapshot_position 904
|
||||
binlog_snapshot_position 945
|
||||
SHOW MASTER STATUS;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000002 245
|
||||
master-bin.000002 286
|
||||
COMMIT;
|
||||
SHOW STATUS LIKE 'binlog_snapshot_%';
|
||||
Variable_name Value
|
||||
binlog_snapshot_file master-bin.000002
|
||||
binlog_snapshot_position 245
|
||||
binlog_snapshot_position 286
|
||||
SHOW MASTER STATUS;
|
||||
File Position Binlog_Do_DB Binlog_Ignore_DB
|
||||
master-bin.000002 245
|
||||
master-bin.000002 286
|
||||
SHOW BINLOG EVENTS;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 4 Format_desc 1 245 Server ver: #, Binlog ver: #
|
||||
master-bin.000001 245 Query 1 380 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
|
||||
master-bin.000001 380 Query 1 492 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
|
||||
master-bin.000001 492 Query 1 560 BEGIN
|
||||
master-bin.000001 560 Query 1 648 use `test`; INSERT INTO t2 VALUES (2)
|
||||
master-bin.000001 648 Query 1 717 COMMIT
|
||||
master-bin.000001 717 Query 1 785 BEGIN
|
||||
master-bin.000001 785 Query 1 877 use `test`; INSERT INTO t1 VALUES (0, "")
|
||||
master-bin.000001 877 Xid 1 904 COMMIT /* XID */
|
||||
master-bin.000001 904 Query 1 972 BEGIN
|
||||
master-bin.000001 972 Query 1 1060 use `test`; INSERT INTO t2 VALUES (3)
|
||||
master-bin.000001 1060 Query 1 1129 COMMIT
|
||||
master-bin.000001 1129 Query 1 1197 BEGIN
|
||||
master-bin.000001 1197 Query 1 1289 use `test`; INSERT INTO t1 VALUES (4, "")
|
||||
master-bin.000001 1289 Xid 1 1316 COMMIT /* XID */
|
||||
master-bin.000001 1316 Query 1 1384 BEGIN
|
||||
master-bin.000001 1384 Query 1 1476 use `test`; INSERT INTO t1 VALUES (1, "")
|
||||
master-bin.000001 1476 Xid 1 1503 COMMIT /* XID */
|
||||
master-bin.000001 1503 Query 1 1571 BEGIN
|
||||
master-bin.000001 1571 Query 1 1668 use `test`; INSERT INTO t1 VALUES (2, "first")
|
||||
master-bin.000001 1668 Query 1 1766 use `test`; INSERT INTO t1 VALUES (2, "second")
|
||||
master-bin.000001 1766 Xid 1 1793 COMMIT /* XID */
|
||||
master-bin.000001 1793 Query 1 1861 BEGIN
|
||||
master-bin.000001 1861 Query 1 1953 use `test`; INSERT INTO t1 VALUES (3, "")
|
||||
master-bin.000001 1953 Xid 1 1980 COMMIT /* XID */
|
||||
master-bin.000001 1980 Rotate 1 2024 master-bin.000002;pos=4
|
||||
master-bin.000001 4 Format_desc 1 246 Server ver: #, Binlog ver: #
|
||||
master-bin.000001 246 Binlog_checkpoint 1 286 master-bin.000001
|
||||
master-bin.000001 286 Query 1 421 use `test`; CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb
|
||||
master-bin.000001 421 Query 1 533 use `test`; CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=myisam
|
||||
master-bin.000001 533 Query 1 601 BEGIN
|
||||
master-bin.000001 601 Query 1 689 use `test`; INSERT INTO t2 VALUES (2)
|
||||
master-bin.000001 689 Query 1 758 COMMIT
|
||||
master-bin.000001 758 Query 1 826 BEGIN
|
||||
master-bin.000001 826 Query 1 918 use `test`; INSERT INTO t1 VALUES (0, "")
|
||||
master-bin.000001 918 Xid 1 945 COMMIT /* XID */
|
||||
master-bin.000001 945 Query 1 1013 BEGIN
|
||||
master-bin.000001 1013 Query 1 1101 use `test`; INSERT INTO t2 VALUES (3)
|
||||
master-bin.000001 1101 Query 1 1170 COMMIT
|
||||
master-bin.000001 1170 Query 1 1238 BEGIN
|
||||
master-bin.000001 1238 Query 1 1330 use `test`; INSERT INTO t1 VALUES (4, "")
|
||||
master-bin.000001 1330 Xid 1 1357 COMMIT /* XID */
|
||||
master-bin.000001 1357 Query 1 1425 BEGIN
|
||||
master-bin.000001 1425 Query 1 1517 use `test`; INSERT INTO t1 VALUES (1, "")
|
||||
master-bin.000001 1517 Xid 1 1544 COMMIT /* XID */
|
||||
master-bin.000001 1544 Query 1 1612 BEGIN
|
||||
master-bin.000001 1612 Query 1 1709 use `test`; INSERT INTO t1 VALUES (2, "first")
|
||||
master-bin.000001 1709 Query 1 1807 use `test`; INSERT INTO t1 VALUES (2, "second")
|
||||
master-bin.000001 1807 Xid 1 1834 COMMIT /* XID */
|
||||
master-bin.000001 1834 Query 1 1902 BEGIN
|
||||
master-bin.000001 1902 Query 1 1994 use `test`; INSERT INTO t1 VALUES (3, "")
|
||||
master-bin.000001 1994 Xid 1 2021 COMMIT /* XID */
|
||||
master-bin.000001 2021 Rotate 1 2065 master-bin.000002;pos=4
|
||||
DROP TABLE t1,t2;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,6 @@ a
|
|||
1
|
||||
2
|
||||
3
|
||||
InnoDB: Last MySQL binlog file position 0 906, file name ./master-bin.000001
|
||||
InnoDB: Last MySQL binlog file position 0 947, file name ./master-bin.000001
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ a
|
|||
1
|
||||
2
|
||||
3
|
||||
InnoDB: Last MySQL binlog file position 0 906, file name ./master-bin.000001
|
||||
InnoDB: Last MySQL binlog file position 0 947, file name ./master-bin.000001
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ COMMIT;
|
|||
Got one of the listed errors
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
a b c d id
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
delete from t1;
|
||||
SET binlog_format= mixed;
|
||||
|
|
@ -58,7 +58,7 @@ a b c d 7
|
|||
a b c d 8
|
||||
a b c d 9
|
||||
a b c d 10
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
|
||||
delete from t1;
|
||||
|
|
@ -81,7 +81,7 @@ a b c d 7
|
|||
a b c d 8
|
||||
a b c d 9
|
||||
a b c d 10
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
|
||||
delete from t1;
|
||||
|
|
@ -104,7 +104,7 @@ a b c d 7
|
|||
a b c d 8
|
||||
a b c d 9
|
||||
a b c d 10
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
|
||||
delete from t1;
|
||||
|
|
@ -117,7 +117,7 @@ COMMIT;
|
|||
Got one of the listed errors
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
a b c d id
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
delete from t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ COMMIT;
|
|||
Got one of the listed errors
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
a b c d id
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
delete from t1;
|
||||
SET binlog_format= mixed;
|
||||
|
|
@ -58,7 +58,7 @@ a b c d 7
|
|||
a b c d 8
|
||||
a b c d 9
|
||||
a b c d 10
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
|
||||
delete from t1;
|
||||
|
|
@ -81,7 +81,7 @@ a b c d 7
|
|||
a b c d 8
|
||||
a b c d 9
|
||||
a b c d 10
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
|
||||
delete from t1;
|
||||
|
|
@ -104,7 +104,7 @@ a b c d 7
|
|||
a b c d 8
|
||||
a b c d 9
|
||||
a b c d 10
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query 1 # use `test`; insert into t1 select * from t2
|
||||
delete from t1;
|
||||
|
|
@ -117,7 +117,7 @@ COMMIT;
|
|||
Got one of the listed errors
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
a b c d id
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
delete from t1;
|
||||
DROP TABLE t1;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ while ($numtests)
|
|||
# table and binlog should be in sync.
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
--replace_column 2 # 5 #
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
|
||||
delete from t1;
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ while ($numtests)
|
|||
# table and binlog should be in sync.
|
||||
SELECT * FROM t1 ORDER BY id;
|
||||
--replace_column 2 # 5 #
|
||||
SHOW BINLOG EVENTS LIMIT 2,1;
|
||||
SHOW BINLOG EVENTS LIMIT 3,1;
|
||||
|
||||
delete from t1;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ a
|
|||
4
|
||||
SHOW BINLOG EVENTS FROM <start_pos>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Binlog_checkpoint 1 # master-bin.000001
|
||||
master-bin.000001 # Query 1 # use `test`; CREATE TABLE t1 (a int primary key)
|
||||
master-bin.000001 # Query 1 # BEGIN
|
||||
master-bin.000001 # Query 1 # use `test`; insert t1 values (1),(2),(3)
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ wait/synch/mutex/sql/Master_info::sleep_lock
|
|||
wait/synch/mutex/sql/MDL_map::mutex
|
||||
wait/synch/mutex/sql/MDL_wait::LOCK_wait_status
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xid_list
|
||||
wait/synch/mutex/sql/MYSQL_RELAY_LOG::LOCK_index
|
||||
wait/synch/mutex/sql/Query_cache::structure_guard_mutex
|
||||
wait/synch/mutex/sql/Relay_log_info::data_lock
|
||||
|
|
@ -129,6 +130,7 @@ wait/synch/cond/sql/Master_info::start_cond
|
|||
wait/synch/cond/sql/Master_info::stop_cond
|
||||
wait/synch/cond/sql/MDL_context::COND_wait_status
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_queue_busy
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_xid_list
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond
|
||||
wait/synch/cond/sql/MYSQL_RELAY_LOG::COND_queue_busy
|
||||
wait/synch/cond/sql/MYSQL_RELAY_LOG::update_cond
|
||||
|
|
|
|||
|
|
@ -56,10 +56,10 @@ where event_name like "%MYSQL_BIN_LOG%"
|
|||
and event_name not like "%MYSQL_BIN_LOG::update_cond"
|
||||
order by event_name;
|
||||
EVENT_NAME COUNT_STAR
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_prep_xids NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_queue_busy NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_xid_list NONE
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index MANY
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_prep_xids NONE
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xid_list MANY
|
||||
"Expect no slave relay log"
|
||||
select * from performance_schema.file_summary_by_instance
|
||||
where event_name like "%relaylog%" order by file_name;
|
||||
|
|
@ -131,10 +131,10 @@ where event_name like "%MYSQL_BIN_LOG%"
|
|||
and event_name not like "%MYSQL_BIN_LOG::update_cond"
|
||||
order by event_name;
|
||||
EVENT_NAME COUNT_STAR
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_prep_xids NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_queue_busy NONE
|
||||
wait/synch/cond/sql/MYSQL_BIN_LOG::COND_xid_list NONE
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_index MANY
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_prep_xids NONE
|
||||
wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK_xid_list MANY
|
||||
"Expect a slave relay log"
|
||||
select
|
||||
substring(file_name, locate("slave-", file_name)) as FILE_NAME,
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ insert into t1 values (1) /* will not be applied on slave due to simulation */;
|
|||
set @@global.debug_dbug='d,simulate_slave_unaware_checksum';
|
||||
start slave;
|
||||
include/wait_for_slave_io_error.inc [errno=1236]
|
||||
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 245, the last event read from 'master-bin.000010' at 245, the last byte read from 'master-bin.000010' at 245.''
|
||||
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Slave can not handle replication events with the checksum that master is configured to log; the first event 'master-bin.000009' at 286, the last event read from 'master-bin.000010' at 246, the last byte read from 'master-bin.000010' at 246.''
|
||||
select count(*) as zero from t1;
|
||||
zero
|
||||
0
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ master-bin.000002 # Query # # COMMIT
|
|||
SELECT * FROM t1;
|
||||
a
|
||||
2
|
||||
show relaylog events in 'slave-relay-bin.000005' from <binlog_start> limit 3,5;
|
||||
show relaylog events in 'slave-relay-bin.000005' from <binlog_start> limit 4,5;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000005 # Query # # BEGIN
|
||||
slave-relay-bin.000005 # Query # # # Dummy ev
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ a b
|
|||
FLUSH LOGS;
|
||||
show binlog events in 'slave-bin.000001' from <start_pos>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 # Binlog_checkpoint 2 # slave-bin.000001
|
||||
slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
|
||||
slave-bin.000001 # Query 1 # CREATE DATABASE test1
|
||||
slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int)
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ a b
|
|||
FLUSH LOGS;
|
||||
show binlog events in 'slave-bin.000001' from <start_pos>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 # Binlog_checkpoint 2 # slave-bin.000001
|
||||
slave-bin.000001 # Query 1 # DROP DATABASE IF EXISTS test1
|
||||
slave-bin.000001 # Query 1 # CREATE DATABASE test1
|
||||
slave-bin.000001 # Query 1 # use `test1`; CREATE TABLE t1(a int primary key, b int)
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
|
|||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4
|
||||
slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
slave-relay-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
||||
slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
|
||||
slave-relay-bin.000003 # Query # # BEGIN
|
||||
slave-relay-bin.000003 # Table_map # # table_id: # (test.t1)
|
||||
|
|
@ -115,8 +116,8 @@ slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4
|
|||
show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1,3;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
slave-relay-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
||||
slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
|
||||
slave-relay-bin.000003 # Query # # BEGIN
|
||||
******** [slave] SHOW RELAYLOG EVENTS ********
|
||||
show relaylog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
|
|
@ -185,6 +186,7 @@ show relaylog events in 'slave-relay-bin.000006' from <binlog_start>;
|
|||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4
|
||||
slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000002
|
||||
slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
|
||||
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1;
|
||||
|
|
@ -194,6 +196,7 @@ slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4
|
|||
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1,3;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000002
|
||||
slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
******** [slave] SHOW RELAYLOG EVENTS ********
|
||||
show relaylog events from <binlog_start>;
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ show relaylog events in 'slave-relay-bin.000003' from <binlog_start>;
|
|||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4
|
||||
slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
slave-relay-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
||||
slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
|
||||
slave-relay-bin.000003 # Query # # BEGIN
|
||||
slave-relay-bin.000003 # Query # # use `test`; INSERT INTO t1 VALUES (1)
|
||||
|
|
@ -100,8 +101,8 @@ slave-relay-bin.000003 # Rotate # # master-bin.000001;pos=4
|
|||
show relaylog events in 'slave-relay-bin.000003' from <binlog_start> limit 1,3;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000003 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
slave-relay-bin.000003 # Binlog_checkpoint # # master-bin.000001
|
||||
slave-relay-bin.000003 # Query # # use `test`; CREATE TABLE t1 (a INT)
|
||||
slave-relay-bin.000003 # Query # # BEGIN
|
||||
******** [slave] SHOW RELAYLOG EVENTS ********
|
||||
show relaylog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
|
|
@ -164,6 +165,7 @@ show relaylog events in 'slave-relay-bin.000006' from <binlog_start>;
|
|||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4
|
||||
slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000002
|
||||
slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
******** [slave] SHOW RELAYLOG EVENTS IN <FILE> LIMIT 1 ********
|
||||
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1;
|
||||
|
|
@ -173,6 +175,7 @@ slave-relay-bin.000006 # Rotate # # master-bin.000002;pos=4
|
|||
show relaylog events in 'slave-relay-bin.000006' from <binlog_start> limit 1,3;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-relay-bin.000006 # Format_desc # # SERVER_VERSION, BINLOG_VERSION
|
||||
slave-relay-bin.000006 # Binlog_checkpoint # # master-bin.000002
|
||||
slave-relay-bin.000006 # Query # # use `test`; DROP TABLE `t1` /* generated by server */
|
||||
******** [slave] SHOW RELAYLOG EVENTS ********
|
||||
show relaylog events from <binlog_start>;
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ connection slave;
|
|||
SELECT * FROM t1;
|
||||
let $binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
|
||||
let $binlog_start= 0;
|
||||
let $binlog_limit=3,5;
|
||||
let $binlog_limit=4,5;
|
||||
--source include/show_relaylog_events.inc
|
||||
|
||||
--echo # Test that slave which cannot tolerate holes in binlog stream but
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue