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_sql_until_before_after.test |
# BUG#13810456: GTID: UNTIL_SQL_BEFORE_GTID DOES NOT WORK # # This test performs multiple invocations of # START SLAVE UNTIL SQL_BEFORE_GTIDS and START SLAVE UNTIL SQL_AFTER_GTIDS # to demonstrate its correct operation. # # Create a set of transactions on the master and applied them individually # by using START SLAVE UNTIL SQL_BEFORE_GTIDS and # START SLAVE UNTIL SQL_AFTER_GTIDS with different sets of missing and/or # already applied GTIDs. # --source include/not_group_replication_plugin.inc --source include/master-slave.inc --source include/have_gtid.inc --connection master --let $master_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1) CREATE TABLE t1(c1 INTEGER) ENGINE= Innodb; --source include/sync_slave_sql_with_master.inc --echo [connection slave] --source include/stop_slave.inc # Generate a set of transactions on the master. # INSERT value is the equal to sequence number. --echo [connection master] --connection master --let $i=2 while ($i != 11) { --eval INSERT INTO t1 VALUES($i) --inc $i } --connection slave --echo [connection slave] # Incorrect START SLAVE UNTIL SQL_BEFORE_GTIDS --replace_result $master_uuid MASTER_UUID --error ER_BAD_SLAVE_UNTIL_COND --eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100 # Incorrect START SLAVE UNTIL SQL_BEFORE_GTIDS --replace_result $master_uuid MASTER_UUID --error ER_BAD_SLAVE_UNTIL_COND --eval START SLAVE SQL_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100 # Incorrect START SLAVE UNTIL SQL_BEFORE_GTIDS --replace_result $master_uuid MASTER_UUID --error ER_BAD_SLAVE_UNTIL_COND --eval START SLAVE IO_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5", MASTER_LOG_FILE= 'foo.bin', MASTER_LOG_POS= 100 # Incorrect START SLAVE UNTIL SQL_BEFORE_GTIDS --replace_result $master_uuid MASTER_UUID --error ER_PARSE_ERROR --eval START SLAVE FOO UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5" # UNTIL GTID --echo Check that START SLAVE IO_THREAD UNTIL ... maintains old behaviour, condition is ignored. --replace_result $master_uuid MASTER_UUID --eval START SLAVE IO_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5" --echo Wait until IO Thread reads all master binlog and stop slave. --let $slave_param= Retrieved_Gtid_Set --let $slave_param_value= $master_uuid:1-10 --source include/wait_for_slave_param.inc --source include/stop_slave_io.inc --echo SQL thread must stop *before* INSERT 4 --replace_result $master_uuid MASTER_UUID --eval START SLAVE SQL_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:4-5" --source include/wait_for_slave_sql_to_stop.inc --let $assert_cond= MAX(c1)=3 FROM t1 --let $assert_text= Rows until 3 in t1 must be replicated now --source include/assert.inc --echo SQL thread must stop *after* INSERT 5 # SQL_AFTER_GTIDS is not working fine with MTS which is 'TODO'. Hence post # BUG14767986 fix 'ER_MTS_FEATURE_IS_NOT_SUPPORTED' warning will be thrown # when MTS is enabled and server will be started in single threaded mode. --disable_warnings --replace_result $master_uuid MASTER_UUID --eval START SLAVE SQL_THREAD UNTIL SQL_AFTER_GTIDS= "$master_uuid:4-5" --enable_warnings --source include/wait_for_slave_sql_to_stop.inc --let $assert_cond= MAX(c1)=5 FROM t1 --let $assert_text= Rows until 5 in t1 must be replicated now --source include/assert.inc --echo SQL thread must stop *before* INSERT 6 --replace_result $master_uuid MASTER_UUID --eval START SLAVE SQL_THREAD, IO_THREAD UNTIL SQL_BEFORE_GTIDS= "$master_uuid:2-7" --source include/wait_for_slave_sql_to_stop.inc --let $assert_cond= MAX(c1)=5 FROM t1 --let $assert_text= Rows until 5 in t1 must be replicated now --source include/assert.inc --echo SQL thread must stop *after* INSERT 5 --echo 1-5 are already applied so it will stop immediately # SQL_AFTER_GTIDS is not working fine with MTS which is 'TODO'. Hence post # BUG14767986 fix 'ER_MTS_FEATURE_IS_NOT_SUPPORTED' warning will be thrown # when MTS is enabled and server will be started in single threaded mode. --disable_warnings --replace_result $master_uuid MASTER_UUID --eval START SLAVE SQL_THREAD, IO_THREAD UNTIL SQL_AFTER_GTIDS= "$master_uuid:1-5" --enable_warnings --source include/wait_for_slave_sql_to_stop.inc --let $assert_cond= MAX(c1)=5 FROM t1 --let $assert_text= Rows until 5 in t1 must be replicated now --source include/assert.inc --echo SQL thread must stop *before* INSERT 10 --replace_result $master_uuid MASTER_UUID --enable_query_log --eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:10" --source include/wait_for_slave_sql_to_stop.inc --let $assert_cond= MAX(c1)=9 FROM t1 --let $assert_text= Rows until 9 in t1 must be replicated now --source include/assert.inc --echo SQL thread must stop *before* INSERT 3-6 --echo 3-6 is already applied so it will stop immediately --replace_result $master_uuid MASTER_UUID --eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:3-6" --source include/wait_for_slave_sql_to_stop.inc --let $assert_cond= MAX(c1)=9 FROM t1 --let $assert_text= Rows until 9 in t1 must be replicated now --source include/assert.inc --echo SQL thread must stop *before* INSERT 9 --echo 9 is already applied so it will stop immediately --replace_result $master_uuid MASTER_UUID --eval START SLAVE UNTIL SQL_BEFORE_GTIDS= "$master_uuid:9" --source include/wait_for_slave_sql_to_stop.inc --let $assert_cond= MAX(c1)=9 FROM t1 --let $assert_text= Rows until 9 in t1 must be replicated now --source include/assert.inc --echo Sync slave with master --source include/start_slave.inc --replace_result $master_uuid MASTER_UUID --disable_result_log --eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:10') --enable_result_log --let $assert_cond= MAX(c1)=10 FROM t1 --let $assert_text= Rows until 10 in t1 must be replicated now --source include/assert.inc # # Bug#24976304 WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS TIMEOUT VALUE HANDLES SOME # INPUTS BADLY # --echo Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with negative timeout --echo value. When SQL_MODE is strict, then it will throw --echo WRONG_ARGUMENTS error. SET @save_sql_mode=@@SESSION.SQL_MODE; SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES"; --replace_result $master_uuid MASTER_UUID --error ER_WRONG_ARGUMENTS --eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', -1); --echo When SQL_MODE is non-strict mode, then it will return NULL immediately --echo without doing any work and generates WRONG_ARGUMENTS warning. SET @@SESSION.SQL_MODE=""; --replace_result $master_uuid MASTER_UUID --eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', -1); SET @@SESSION.SQL_MODE=@save_sql_mode; --echo Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with fractional timeout --echo value. Earlier(before fix), 0.4 is read as integer value '0' and --echo the function hanged forever (or till all the specified gtids are --echo executed). Now(after fix) 0.4 will be read as double 0.4 and will waitfor --echo atleast 0.4 seconds (or till all the specified gtids are executed). --echo Also check that function returns -1 if the timeout has been exceeded. --let $assert_text= WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS returns -1 if the timeout has been exceeded. --let $query_result= query_get_value("SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', 0.4) AS VALUE", VALUE, 1) --let $assert_cond= "$query_result" = "-1" --source include/assert.inc # End of Test Bug#24976304 # Cleanup --connection master DROP TABLE t1; --source include/rpl_end.inc