From 71e9e9489b2cf397a4a6e03bf445a1ad8f0fb077 Mon Sep 17 00:00:00 2001 From: Shivji Kumar Jha Date: Sun, 17 Feb 2013 01:42:28 +0530 Subject: BUG#15965353- RPL.RPL_ROW_UNTIL FAILS ON PB2, PLATFORM= MACOSX10.6 X86_64 MAX Problem: The test was failing on pb2's mac machine because it was not cleaned up properly. The test checks if the command 'start slave until' throws a proper error when issued with a wrong number/type of parameters. After this,the replication stream was stopped using the include file 'rpl_end.inc'. The errors thrown earlier left the slave in an inconsistent state to be closed by the include file which was caught by the mac machine. Fix: Started slave by invoking start_slave.inc to have a working slave before calling rpl_reset.inc Problem: The test file was not in a good shape. It tested start slave until relay log file/pos combination wrongly. A couple of commands were executed at master and replicated at slave. Next, the coordinates in terms of relay log file and pos were noted down followed by reset slave and start slave until saved relay log file/pos. Reset slave deletes all relay log files and makes the slave forget its replication position. So, using the saved coordiantes after reset slave is wrong. Fix: Split the test in two parts: a) Test for start slave until master log file/pos and checking for correct errors in the failure scenarios. b) Test for start slave until relay log file/pos. Problem: The variables auto_increment_increment and auto_increment_offset were set in the the include file rpl_init.inc. This was only configured for some connections that are rarely used by test cases, so likely that it will cause confusion. If replication tests want to setup these variables they should do so explicitly. Fix: a) Removed code to set the variables auto_increment_increment and auto_increment_offset in the include file. b) Updated tests files using the same. --- mysql-test/include/rpl_init.inc | 3 - .../suite/rpl/r/rpl_circular_for_4_hosts.result | 12 ++++ mysql-test/suite/rpl/r/rpl_row_until.result | 22 ++++--- mysql-test/suite/rpl/t/disabled.def | 1 - .../suite/rpl/t/rpl_circular_for_4_hosts.test | 12 ++++ mysql-test/suite/rpl/t/rpl_row_until.test | 75 +++++++++++++++------- 6 files changed, 90 insertions(+), 35 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/include/rpl_init.inc b/mysql-test/include/rpl_init.inc index 3cf78dc2979..8325b2937b6 100644 --- a/mysql-test/include/rpl_init.inc +++ b/mysql-test/include/rpl_init.inc @@ -7,7 +7,6 @@ # well as extra connections server_1_1, server_2_1, ..., # server_N_1. server_I and server_I_1 are connections to the same # server. -# - Sets up @@auto_increment_increment and @@auto_increment_increment. # - Verifies that @@server_id of all servers are different. # - Calls RESET MASTER, RESET SLAVE, USE test, CHANGE MASTER, START SLAVE. # - Sets the connection to server_1 before exiting. @@ -179,8 +178,6 @@ while ($_rpl_server) RESET MASTER; RESET SLAVE; } - eval SET auto_increment_increment= $rpl_server_count; - eval SET auto_increment_offset= $_rpl_server; --dec $_rpl_server } diff --git a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result index 412021d6446..66974762ebc 100644 --- a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result +++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result @@ -1,6 +1,18 @@ *** Set up circular replication on four servers *** include/rpl_init.inc [topology=1->2->3->4->1] +[connection server_4] +SET auto_increment_increment= 4; +SET auto_increment_offset= 4; +[connection server_3] +SET auto_increment_increment= 4; +SET auto_increment_offset= 3; +[connection server_2] +SET auto_increment_increment= 4; +SET auto_increment_offset= 2; +[connection server_1] +SET auto_increment_increment= 4; +SET auto_increment_offset= 1; *** Preparing data *** CREATE TABLE t1 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=MyISAM; CREATE TABLE t2 (a INT NOT NULL AUTO_INCREMENT, b VARCHAR(100), c INT NOT NULL, PRIMARY KEY(a)) ENGINE=InnoDB; diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result index be8f17c6f01..5ab39a00946 100644 --- a/mysql-test/suite/rpl/r/rpl_row_until.result +++ b/mysql-test/suite/rpl/r/rpl_row_until.result @@ -27,12 +27,6 @@ n 3 4 include/check_slave_param.inc [Exec_Master_Log_Pos] -include/wait_for_slave_sql_to_stop.inc -SELECT * FROM t2; -n -1 -2 -include/check_slave_param.inc [Exec_Master_Log_Pos] START SLAVE; include/wait_for_slave_to_start.inc include/stop_slave.inc @@ -54,6 +48,18 @@ START SLAVE; START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS; Warnings: Note 1254 Slave is already running -include/stop_slave.inc -RESET SLAVE; +include/start_slave.inc +Warnings: +Note 1254 Slave is already running +include/rpl_reset.inc +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); +include/stop_slave_sql.inc +INSERT INTO t1 VALUES (2); +INSERT INTO t1 VALUES (3); +include/sync_slave_io_with_master.inc +include/wait_for_slave_sql_to_stop.inc +include/assert.inc [table t1 should have two rows.] +include/start_slave.inc +DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/disabled.def b/mysql-test/suite/rpl/t/disabled.def index 86ecbb09594..d3339c1bfe8 100644 --- a/mysql-test/suite/rpl/t/disabled.def +++ b/mysql-test/suite/rpl/t/disabled.def @@ -12,4 +12,3 @@ rpl_row_create_table : Bug#11759274 Feb 27 2010 andrei failed different way than earlier with bug#45576 rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock -rpl_row_until @macosx : BUG#15965353 RPL.RPL_ROW_UNTIL FAILS ON PB2 , PLATFORM= MACOSX10.6 X86_64 MAX diff --git a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test index 1380b3d97cf..f1d42089869 100644 --- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test +++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test @@ -20,6 +20,18 @@ --source include/rpl_init.inc --echo +#set auto inc variables at each server +--let $_rpl_server= $rpl_server_count +while ($_rpl_server) +{ + --let $rpl_connection_name= server_$_rpl_server + --source include/rpl_connection.inc + eval SET auto_increment_increment= $rpl_server_count; + eval SET auto_increment_offset= $_rpl_server; + + --dec $_rpl_server +} + # Preparing data. --echo *** Preparing data *** --connection server_1 diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test index eaa99c29694..1e5bc341b1a 100644 --- a/mysql-test/suite/rpl/t/rpl_row_until.test +++ b/mysql-test/suite/rpl/t/rpl_row_until.test @@ -2,7 +2,13 @@ -- source include/have_binlog_format_row.inc -- source include/master-slave.inc -# Note: The test is dependent on binlog positions +############################################################################## +# The test is dependent on binlog positions. The test is divided into two +# sections. The first section checks START SLAVE UNTIL MASTER_LOG_FILE = +# 'log_name', MASTER_LOG_POS = log_pos followed by a couple of failure +# scenarios. The second section checks START SLAVE UNTIL RELAY_LOG_FILE = +# 'log_name', RELAY_LOG_POS = log_pos. +############################################################################## # Create some events on master connection master; @@ -22,14 +28,8 @@ let $master_pos_create_t2= query_get_value(SHOW BINLOG EVENTS, Pos, 8); INSERT INTO t2 VALUES (1),(2); save_master_pos; # Save master log position for query INSERT INTO t2 VALUES (1),(2); -let $master_pos_insert1_t2= query_get_value(SHOW BINLOG EVENTS, End_log_pos, 12); -sync_slave_with_master; - -# Save relay log position for query INSERT INTO t2 VALUES (1),(2); -let $relay_log_file= query_get_value(show slave status, Relay_Log_File,1); -let $relay_pos_insert1_t2= query_get_value(show slave status, Relay_Log_Pos, 1); +let $master_pos_insert1_t2= query_get_value(SHOW MASTER STATUS, Position, 1); -connection master; INSERT INTO t2 VALUES (3),(4); DROP TABLE t2; # Save master log position for query INSERT INTO t2 VALUES (1),(2); @@ -68,17 +68,6 @@ SELECT * FROM t1; --let $slave_param_value= $master_pos_drop_t1 --source include/check_slave_param.inc -# Try replicate all up to and not including the second insert to t2; ---disable_query_log -eval START SLAVE UNTIL RELAY_LOG_FILE='$relay_log_file', RELAY_LOG_POS=$relay_pos_insert1_t2; ---enable_query_log ---source include/wait_for_slave_sql_to_stop.inc -SELECT * FROM t2; - ---let $slave_param= Exec_Master_Log_Pos ---let $slave_param_value= $master_pos_insert1_t2 ---source include/check_slave_param.inc - # clean up START SLAVE; --source include/wait_for_slave_to_start.inc @@ -119,9 +108,49 @@ START SLAVE; --replace_result 740 MASTER_LOG_POS START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740; ---source include/stop_slave.inc -# Clear slave IO error. -RESET SLAVE; +--source include/start_slave.inc + +############################################################################## +# The second section - checks START SLAVE UNTIL RELAY_LOG_FILE =# 'log_name', +# RELAY_LOG_POS = log_pos. This section of the test does the following: +# 1) At master, create a table and inserts a value. Let slave replicate this. +# 2) Stop slave sql thread. +# 3) Insert some more values at master. Note that io thread copies this insert +# 4) Use start slave until to start the sql thread and check if it +# stops at the correct position. +############################################################################## ---let $rpl_only_running_threads= 1 +--source include/rpl_reset.inc + +--connection master +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1); + +--sync_slave_with_master +--source include/stop_slave_sql.inc + +--connection master +INSERT INTO t1 VALUES (2); +--let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1) +INSERT INTO t1 VALUES (3); + +--source include/sync_slave_io_with_master.inc + +--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File,1) +--source include/get_relay_log_pos.inc + +--disable_query_log +--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 +--let $assert_text= table t1 should have two rows. +--source include/assert.inc + +#cleanup +--source include/start_slave.inc +--connection master +DROP TABLE t1; +--sync_slave_with_master --source include/rpl_end.inc -- cgit v1.2.1