Skip to content

Commit

Permalink
test cleanup: use --replace_result correctly
Browse files Browse the repository at this point in the history
* replace binlog positions where they are calculated
  (instead of --disable_query_log)
* don't replace binlog positions when they're hard-coded anyway
  • Loading branch information
vuvova committed Sep 4, 2015
1 parent 55d7871 commit 781e18e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 24 deletions.
8 changes: 5 additions & 3 deletions mysql-test/suite/rpl/r/rpl_row_until.result
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ INSERT INTO t2 VALUES (3),(4);
DROP TABLE t2;
include/stop_slave.inc
RESET SLAVE;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1
CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t1;
n
Expand All @@ -18,7 +19,7 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t1;
n
Expand All @@ -30,7 +31,7 @@ include/check_slave_param.inc [Exec_Master_Log_Pos]
START SLAVE;
include/wait_for_slave_to_start.inc
include/stop_slave.inc
START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2
START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_create_t2;
include/wait_for_slave_param.inc [Until_Log_Pos]
include/wait_for_slave_sql_to_stop.inc
include/check_slave_param.inc [Exec_Master_Log_Pos]
Expand All @@ -55,6 +56,7 @@ include/stop_slave_sql.inc
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (3);
include/sync_slave_io_with_master.inc
start slave until relay_log_file='slave-relay-bin.000002', relay_log_pos=relay_log_pos;
include/wait_for_slave_sql_to_stop.inc
include/assert.inc [table t1 should have two rows.]
include/start_slave.inc
Expand Down
10 changes: 5 additions & 5 deletions mysql-test/suite/rpl/r/rpl_stm_until.result
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ n
3
4
include/check_slave_param.inc [Exec_Master_Log_Pos]
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS;
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
include/wait_for_slave_io_to_start.inc
include/wait_for_slave_sql_to_stop.inc
select * from t1;
Expand All @@ -52,18 +52,18 @@ include/wait_for_slave_io_to_start.inc
include/wait_for_slave_sql_to_stop.inc
include/check_slave_param.inc [Exec_Master_Log_Pos]
==== Test various error conditions ====
start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS;
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS;
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002';
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=MASTER_LOG_POS;
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave sql_thread;
start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
start slave until master_log_file='master-bin.000001', master_log_pos=776;
Warnings:
Note 1254 Slave is already running
include/stop_slave.inc
Expand Down
15 changes: 4 additions & 11 deletions mysql-test/suite/rpl/t/rpl_row_until.test
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,14 @@ sync_slave_with_master;
--source include/stop_slave.inc
# Reset slave.
RESET SLAVE;
--disable_query_log
--replace_result $MASTER_MYPORT MASTER_MYPORT
eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
--enable_query_log

# Try to replicate all queries until drop of t1

connection slave;
echo START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_drop_t1;
--disable_query_log
--replace_result $master_pos_drop_t1 master_pos_drop_t1
eval START SLAVE UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_drop_t1;
--enable_query_log
--source include/wait_for_slave_sql_to_stop.inc

# Here table should be still not deleted
Expand All @@ -59,7 +56,6 @@ SELECT * FROM t1;
--source include/check_slave_param.inc

# This should fail right after start
--replace_result 291 MASTER_LOG_POS
START SLAVE UNTIL MASTER_LOG_FILE='master-no-such-bin.000001', MASTER_LOG_POS=291;
--source include/wait_for_slave_sql_to_stop.inc
# again this table should be still not deleted
Expand All @@ -77,10 +73,8 @@ sync_slave_with_master;
--source include/stop_slave.inc

# This should stop immediately as we are already there
echo START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=master_pos_create_t2;
--disable_query_log
--replace_result $master_pos_create_t2 master_pos_create_t2
eval START SLAVE SQL_THREAD UNTIL MASTER_LOG_FILE='$master_log_file', MASTER_LOG_POS=$master_pos_create_t2;
--enable_query_log
let $slave_param= Until_Log_Pos;
let $slave_param_value= $master_pos_create_t2;
--source include/wait_for_slave_param.inc
Expand Down Expand Up @@ -140,9 +134,8 @@ INSERT INTO t1 VALUES (3);
--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File,1)
--source include/get_relay_log_pos.inc

--disable_query_log
--replace_result $relay_log_pos relay_log_pos
--eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos
--enable_query_log
--source include/wait_for_slave_sql_to_stop.inc

--let $assert_cond= COUNT(*) = 2 FROM t1
Expand Down
5 changes: 0 additions & 5 deletions mysql-test/suite/rpl/t/rpl_stm_until.test
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ select * from t1;
--source include/check_slave_param.inc

# this should fail right after start
--replace_result 291 MASTER_LOG_POS
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
--source include/wait_for_slave_io_to_start.inc
--source include/wait_for_slave_sql_to_stop.inc
Expand Down Expand Up @@ -107,22 +106,18 @@ eval start slave until master_log_file='$master_log_file', master_log_pos=$maste

--echo ==== Test various error conditions ====

--replace_result 561 MASTER_LOG_POS
--error 1277
start slave until master_log_file='master-bin', master_log_pos=561;
--replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
--error 1277
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
--error 1277
start slave until master_log_file='master-bin.000001';
--error 1277
start slave until relay_log_file='slave-relay-bin.000002';
--replace_result 561 MASTER_LOG_POS
--error 1277
start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
# Warning should be given for second command
start slave sql_thread;
--replace_result 776 MASTER_LOG_POS
start slave until master_log_file='master-bin.000001', master_log_pos=776;

#
Expand Down

0 comments on commit 781e18e

Please sign in to comment.