Current Path : /home/usr.opt/mysql57/mysql-test/suite/rpl/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/rpl/t/rpl_gtid_skip_with_parser_error.test |
# ==== Purpose ==== # # Test that GTID auto skip works even when replication applier is applying # events that would lead to ER_PARSE_ERROR. # # For this test case a binary log file was generated in MySQL 5.6 creating # a table with a name that is a reserved word in MySQL 5.7+. # # Replicating the binary log to a 5.7+ slave shall make the applier thread # to stop once reaching the offending transaction. # # Supposing a DBA/operator fixed the issue manually and the GTID of the # offending transaction was committed so the replicated one shall be skipped # by GTID auto skip functionality, restarting the slave applier thread shall # not hit errors for this transaction anymore. # # The binary log file generated in MySQL 5.6 has the following content: # #+-------------------+------+----------------+-----------+-------------+-------------------------------------------------------------------+ #| Log_name | Pos | Event_type | Server_id | End_log_pos | Info | #+-------------------+------+----------------+-----------+-------------+-------------------------------------------------------------------+ #| master-bin.000001 | 4 | Format_desc | 1 | 120 | Server ver: 5.6.41-debug-log, Binlog ver: 4 | #| master-bin.000001 | 120 | Previous_gtids | 1 | 151 | | #| master-bin.000001 | 151 | Gtid | 1 | 199 | SET @@SESSION.GTID_NEXT= '11111111-1111-1111-1111-111111111111:1' | #| master-bin.000001 | 199 | Query | 1 | 308 | use `test`; CREATE TABLE t1 (a int PRIMARY KEY) | #| master-bin.000001 | 308 | Gtid | 1 | 356 | SET @@SESSION.GTID_NEXT= '11111111-1111-1111-1111-111111111111:2' | #| master-bin.000001 | 356 | Query | 1 | 458 | use `test`; CREATE TABLE GENERATED LIKE test.t1 | #| master-bin.000001 | 458 | Gtid | 1 | 506 | SET @@SESSION.GTID_NEXT= '11111111-1111-1111-1111-111111111111:3' | #| master-bin.000001 | 506 | Query | 1 | 585 | BEGIN | #| master-bin.000001 | 585 | Query | 1 | 701 | use `test`; INSERT INTO GENERATED VALUES (1), (2), (3) | #| master-bin.000001 | 701 | Query | 1 | 781 | COMMIT | #| master-bin.000001 | 781 | Gtid | 1 | 829 | SET @@SESSION.GTID_NEXT= '11111111-1111-1111-1111-111111111111:4' | #| master-bin.000001 | 829 | Query | 1 | 901 | BEGIN | #| master-bin.000001 | 901 | Table_map | 1 | 953 | table_id: 75 (test.GENERATED) | #| master-bin.000001 | 953 | Write_rows | 1 | 993 | table_id: 75 flags: STMT_END_F | #| master-bin.000001 | 993 | Query | 1 | 1066 | COMMIT | #| master-bin.000001 | 1066 | Gtid | 1 | 1114 | SET @@SESSION.GTID_NEXT= '11111111-1111-1111-1111-111111111111:5' | #| master-bin.000001 | 1114 | Query | 1 | 1229 | use `test`; DROP TABLE `t1` /* generated by server */ | #| master-bin.000001 | 1229 | Gtid | 1 | 1277 | SET @@SESSION.GTID_NEXT= '11111111-1111-1111-1111-111111111111:6' | #| master-bin.000001 | 1277 | Query | 1 | 1399 | use `test`; DROP TABLE `GENERATED` /* generated by server */ | #+-------------------+------+----------------+-----------+-------------+-------------------------------------------------------------------+ # # ==== Related Bugs and Worklogs ==== # # BUG#27638268 GTID AUTO SKIP DOES NOT WORK FOR QUERIES WITH PARSER ERRORS # # This test case is not compatible with SBR. --source include/have_binlog_format_mixed_or_row.inc --source include/have_gtid.inc --let $rpl_skip_start_slave = 1 --source include/master-slave.inc --let $MASTER_DATADIR= `select @@datadir` # Restart the master to make it use the 5.6 binary log file as its own. --let $rpl_server_number= 1 --source include/rpl_stop_server.inc --remove_file $MASTER_DATADIR/master-bin.000001 --copy_file std_data/binlog_56_gtid_reserved_word.000001 $MASTER_DATADIR/master-bin.000001 --source include/rpl_start_server.inc # Assert that all 6 transactions are assumed as already applied. --let $assert_text= All transactions are assumed as applied on master --let $assert_cond= "[SELECT @@GLOBAL.gtid_executed]" = "11111111-1111-1111-1111-111111111111:1-6" --source include/assert.inc # Start and sync slave's receiver thread --source include/rpl_connection_slave.inc --source include/start_slave_io.inc --source include/rpl_connection_master.inc --source include/sync_slave_io_with_master.inc # Start slave's applier thread. It should stop with ER_PARSE_ERROR. START SLAVE SQL_THREAD; --let $slave_sql_errno= convert_error(ER_PARSE_ERROR) --source include/wait_for_slave_sql_error.inc # Assert that only 1st transaction is applied. --let $assert_text= Only 1st transaction is applied on slave --let $assert_cond= "[SELECT @@GLOBAL.gtid_executed]" = "11111111-1111-1111-1111-111111111111:1" --source include/assert.inc # Prepare GTID auto skip of offending transactions. SET GTID_NEXT='11111111-1111-1111-1111-111111111111:2'; BEGIN; COMMIT; SET GTID_NEXT='11111111-1111-1111-1111-111111111111:3'; BEGIN; COMMIT; SET GTID_NEXT='11111111-1111-1111-1111-111111111111:4'; BEGIN; COMMIT; SET GTID_NEXT='11111111-1111-1111-1111-111111111111:6'; BEGIN; COMMIT; SET GTID_NEXT=AUTOMATIC; # Restart applier thread that shall sync without issues. --source include/start_slave_sql.inc --source include/sync_slave_sql_with_io.inc CALL mtr.add_suppression("The slave coordinator and worker threads are stopped"); --source include/rpl_end.inc