=== modified file 'mysql-test/suite/rpl/r/rpl_gtid_crash.result' --- mysql-test/suite/rpl/r/rpl_gtid_crash.result 2014-09-02 12:07:01 +0000 +++ mysql-test/suite/rpl/r/rpl_gtid_crash.result 2014-10-23 20:40:27 +0000 @@ -133,9 +133,15 @@ 3 SELECT * from t1 WHERE a > 10 ORDER BY a; a +SELECT @@global.gtid_binlog_pos, @@global.gtid_current_pos; +@@global.gtid_binlog_pos @@global.gtid_current_pos +1-1-2,2-1-1,0-1-7 1-1-2,0-1-7,2-1-1 # Wait 30 seconds for SQL thread to catch up with IO thread SELECT * from t1 WHERE a > 10 ORDER BY a; a +SELECT @@global.gtid_binlog_pos, @@global.gtid_slave_pos, @@global.gtid_current_pos; +@@global.gtid_binlog_pos @@global.gtid_slave_pos @@global.gtid_current_pos +1-1-2,0-1-7,2-1-1 1-1-2,2-1-1,0-1-7 1-1-2,2-1-1,0-1-7 # Repeat this with additional transactions on the master SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; @@ -175,11 +181,17 @@ a 13 14 +SELECT @@global.gtid_binlog_pos, @@global.gtid_current_pos; +@@global.gtid_binlog_pos @@global.gtid_current_pos +1-1-2,2-1-1,0-1-9 1-1-2,0-1-9,2-1-1 # Wait 30 seconds for SQL thread to catch up with IO thread SELECT * from t1 WHERE a > 10 ORDER BY a; a 13 14 +SELECT @@global.gtid_binlog_pos, @@global.gtid_slave_pos, @@global.gtid_current_pos; +@@global.gtid_binlog_pos @@global.gtid_slave_pos @@global.gtid_current_pos +1-1-2,0-1-9,2-1-1 1-1-2,2-1-1,0-1-9 1-1-2,2-1-1,0-1-9 # Repeat this with additional transactions on the master SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; BEGIN; @@ -205,5 +217,44 @@ 14 23 24 +# Repeat this with slave restart +SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; +BEGIN; +INSERT INTO t1 VALUES (25); +COMMIT; +ERROR HY000: Error writing file 'master-bin' (errno: 11 "Resource temporarily unavailable") +SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; +COMMIT; +Got one of the listed errors +# Wait 30 seconds for IO thread to connect and SQL thread to catch up +# with IO thread. +include/stop_slave.inc +SELECT @@global.gtid_binlog_pos, @@global.gtid_current_pos; +@@global.gtid_binlog_pos @@global.gtid_current_pos +1-1-2,2-1-1,0-1-11 1-1-2,0-1-11,2-1-1 +INSERT INTO t1 VALUES (26); +INSERT INTO t1 VALUES (27); +SELECT * from t1 WHERE a > 10 ORDER BY a; +a +13 +14 +23 +24 +26 +27 +include/save_master_gtid.inc +SELECT @@global.gtid_binlog_pos, @@global.gtid_slave_pos, @@global.gtid_current_pos; +@@global.gtid_binlog_pos @@global.gtid_slave_pos @@global.gtid_current_pos +1-1-2,0-1-11,2-1-1 1-1-2,2-1-1,0-1-11 1-1-2,2-1-1,0-1-11 +include/start_slave.inc +include/sync_with_master_gtid.inc +SELECT * from t1 WHERE a > 10 ORDER BY a; +a +13 +14 +23 +24 +26 +27 DROP TABLE t1; include/rpl_end.inc === modified file 'mysql-test/suite/rpl/t/rpl_gtid_crash.test' --- mysql-test/suite/rpl/t/rpl_gtid_crash.test 2014-09-02 12:07:01 +0000 +++ mysql-test/suite/rpl/t/rpl_gtid_crash.test 2014-10-23 20:40:27 +0000 @@ -333,6 +333,7 @@ SELECT @@GLOBAL.server_id; SELECT * from t1 WHERE a > 10 ORDER BY a; +SELECT @@global.gtid_binlog_pos, @@global.gtid_current_pos; --echo # Wait 30 seconds for SQL thread to catch up with IO thread --connection server_2 @@ -357,6 +358,7 @@ } SELECT * from t1 WHERE a > 10 ORDER BY a; +SELECT @@global.gtid_binlog_pos, @@global.gtid_slave_pos, @@global.gtid_current_pos; --echo # Repeat this with additional transactions on the master @@ -420,6 +422,7 @@ SELECT @@GLOBAL.server_id; SELECT * from t1 WHERE a > 10 ORDER BY a; +SELECT @@global.gtid_binlog_pos, @@global.gtid_current_pos; --echo # Wait 30 seconds for SQL thread to catch up with IO thread --connection server_2 @@ -444,6 +447,7 @@ } SELECT * from t1 WHERE a > 10 ORDER BY a; +SELECT @@global.gtid_binlog_pos, @@global.gtid_slave_pos, @@global.gtid_current_pos; --echo # Repeat this with additional transactions on the master @@ -479,6 +483,79 @@ --source include/sync_with_master_gtid.inc SELECT * from t1 WHERE a > 10 ORDER BY a; +--echo # Repeat this with slave restart + +--connection server_1 +--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +wait +EOF + +SET GLOBAL debug_dbug="+d,inject_error_writing_xid"; +BEGIN; +INSERT INTO t1 VALUES (25); +--error ER_ERROR_ON_WRITE +COMMIT; +SET GLOBAL debug_dbug="+d,crash_dispatch_command_before"; +--error 2006,2013 +COMMIT; + +--source include/wait_until_disconnected.inc + +--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +restart +EOF + +--connection server_1 +--enable_reconnect +--source include/wait_until_connected_again.inc + +--connection server_2 +--echo # Wait 30 seconds for IO thread to connect and SQL thread to catch up +--echo # with IO thread. +--let $wait_timeout= 300 +while ($wait_timeout != 0) +{ + --let $connected=`SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE State = 'Waiting for master to send event'` + if ($connected) + { + --let $read_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1) + --let $exec_log_pos= query_get_value('SHOW SLAVE STATUS', Exec_Master_Log_Pos, 1) + if ($read_log_pos == $exec_log_pos) + { + --let $wait_timeout= 0 + } + if ($read_log_pos != $exec_log_pos) + { + --sleep 0.1 + --dec $wait_timeout + } + } + if (!$connected) + { + --sleep 0.1 + --dec $wait_timeout + } +} +if (`SELECT NOT $connected OR $read_log_pos != $exec_log_pos`) +{ + --die Timeout wait for IO thread to connect and SQL thread to catch up with IO thread +} + +--source include/stop_slave.inc + +--connection server_1 +SELECT @@global.gtid_binlog_pos, @@global.gtid_current_pos; +INSERT INTO t1 VALUES (26); +INSERT INTO t1 VALUES (27); +SELECT * from t1 WHERE a > 10 ORDER BY a; +--source include/save_master_gtid.inc + +--connection server_2 +SELECT @@global.gtid_binlog_pos, @@global.gtid_slave_pos, @@global.gtid_current_pos; +--source include/start_slave.inc +--source include/sync_with_master_gtid.inc +SELECT * from t1 WHERE a > 10 ORDER BY a; + --connection server_1 DROP TABLE t1; === modified file 'sql/log_event.cc' --- sql/log_event.cc 2014-10-09 08:30:11 +0000 +++ sql/log_event.cc 2014-10-23 20:40:27 +0000 @@ -5090,6 +5090,7 @@ "the master died while writing the transaction to " "its binary log, thus rolled back too."); rgi->cleanup_context(thd, 1); + rgi->gtid_sub_id= 0; } /*