Commit b55468d7 authored by unknown's avatar unknown

Updated patch for Bug#28497 based off of Magnus's review


mysql-test/include/wait_for_slave_io_to_stop.inc:
  Updated previous commit to include Magnus's change request from review. In addition, I moved it from the mysql-5.1 to mysql-5.1-maint clone. We now have 3 new replications tools and one tool that has been refactored. 1) include/wait_for_slave_to_stop.inc replaces the old mysqltest.c wait_for_slave_to_stop. NEW: 2) include/wait_for_slave_sql_to_stop.inc is for when you are expecting the slave to get an SQL error and waiting for the SQL Thread to stop. 3) include/wait_for_slave_io_to_stop.inc is used for test that you expect sometype of IO error and the IO Thread to stop. 4) include/wait_for_slave_to_start.inc for waiting for the slave to completely start before moving forward in the test. All 4 tests have a built in loop that will stop the test if any of the tools take too long.
mysql-test/include/wait_for_slave_sql_to_stop.inc:
  Updated previous commit to include Magnus's change request from review. In addition, I moved it from the mysql-5.1 to mysql-5.1-maint clone. We now have 3 new replications tools and one tool that has been refactored. 1) include/wait_for_slave_to_stop.inc replaces the old mysqltest.c wait_for_slave_to_stop. NEW: 2) include/wait_for_slave_sql_to_stop.inc is for when you are expecting the slave to get an SQL error and waiting for the SQL Thread to stop. 3) include/wait_for_slave_io_to_stop.inc is used for test that you expect sometype of IO error and the IO Thread to stop. 4) include/wait_for_slave_to_start.inc for waiting for the slave to completely start before moving forward in the test. All 4 tests have a built in loop that will stop the test if any of the tools take too long.
mysql-test/include/wait_for_slave_to_start.inc:
  Updated previous commit to include Magnus's change request from review. In addition, I moved it from the mysql-5.1 to mysql-5.1-maint clone. We now have 3 new replications tools and one tool that has been refactored. 1) include/wait_for_slave_to_stop.inc replaces the old mysqltest.c wait_for_slave_to_stop. NEW: 2) include/wait_for_slave_sql_to_stop.inc is for when you are expecting the slave to get an SQL error and waiting for the SQL Thread to stop. 3) include/wait_for_slave_io_to_stop.inc is used for test that you expect sometype of IO error and the IO Thread to stop. 4) include/wait_for_slave_to_start.inc for waiting for the slave to completely start before moving forward in the test. All 4 tests have a built in loop that will stop the test if any of the tools take too long.
mysql-test/include/wait_for_slave_to_stop.inc:
  Updated previous commit to include Magnus's change request from review. In addition, I moved it from the mysql-5.1 to mysql-5.1-maint clone. We now have 3 new replications tools and one tool that has been refactored. 1) include/wait_for_slave_to_stop.inc replaces the old mysqltest.c wait_for_slave_to_stop. NEW: 2) include/wait_for_slave_sql_to_stop.inc is for when you are expecting the slave to get an SQL error and waiting for the SQL Thread to stop. 3) include/wait_for_slave_io_to_stop.inc is used for test that you expect sometype of IO error and the IO Thread to stop. 4) include/wait_for_slave_to_start.inc for waiting for the slave to completely start before moving forward in the test. All 4 tests have a built in loop that will stop the test if any of the tools take too long.
mysql-test/t/rpl_critical_errors.test:
  Updated to use new tool(s)
mysql-test/t/rpl_dual_pos_advance.test:
  Updated to use new tool(s)
mysql-test/t/rpl_known_bugs_detection.test:
  Updated to use new tool(s)
mysql-test/t/rpl_rotate_logs.test:
  Updated to use new tool(s)
mysql-test/t/rpl_row_inexist_tbl.test:
  Updated to use new tool(s)
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
  Updated to use new tool(s)
mysql-test/extra/rpl_tests/rpl_loaddata.test:
  Updated to use new tool(s)
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test:
  Updated to use new tool(s)
mysql-test/extra/rpl_tests/rpl_stm_000001.test:
  Updated to use new tool(s)
mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test:
  Updated to use new tool(s)
parent 0c2338e7
......@@ -138,7 +138,7 @@ INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TEST
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -183,7 +183,7 @@ INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -228,7 +228,7 @@ INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -274,7 +274,7 @@ INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -427,7 +427,7 @@ sync_slave_with_master;
#connection slave;
#--echo *** Select from T9 ***
#wait_for_slave_to_stop;
#--source include/wait_for_slave_sql_to_stop.inc
#--replace_result $MASTER_MYPORT MASTER_PORT
#--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
#--query_vertical SHOW SLAVE STATUS
......@@ -469,7 +469,7 @@ INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -513,7 +513,7 @@ INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -723,7 +723,7 @@ ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
--echo *** Expect slave to fail with Error 1060 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -832,7 +832,7 @@ INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
--echo *** Expect slave to fail with Error 1522 ***
--echo ********************************************
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......
......@@ -68,7 +68,7 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
# Skip the bad event and see if error is cleared in SHOW SLAVE STATUS by START
# SLAVE, even though we are not executing any event (as sql_slave_skip_counter
......@@ -93,7 +93,7 @@ connection slave;
# The SQL slave thread should be stopped now.
# Exec_Master_Log_Pos should point to the start of Execute event
# for last load data.
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
# CHANGE MASTER and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
......@@ -116,7 +116,7 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
save_master_pos;
connection slave;
# The SQL slave thread should be stopped now.
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
......@@ -152,7 +152,7 @@ load data infile '../std_data_ln/rpl_loaddata2.dat' into table t2 fields
terminated by ',' optionally enclosed by '%' escaped by '@' lines terminated by
'\n##\n' starting by '>' ignore 1 lines;
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
drop table t2;
connection master;
drop table t2;
......
......@@ -113,7 +113,7 @@ sync_slave_with_master;
connection master;
INSERT INTO t1_nodef VALUES (1,2);
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -127,7 +127,7 @@ sync_slave_with_master;
connection master;
INSERT INTO t2 VALUES (2,4);
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -141,7 +141,7 @@ sync_slave_with_master;
connection master;
INSERT INTO t4 VALUES (4);
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -155,7 +155,7 @@ sync_slave_with_master;
connection master;
INSERT INTO t5 VALUES (5,10,25);
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......@@ -169,7 +169,7 @@ sync_slave_with_master;
connection master;
INSERT INTO t6 VALUES (6,12,36);
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
--replace_result $MASTER_MYPORT MASTER_PORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
--query_vertical SHOW SLAVE STATUS
......
......@@ -98,7 +98,7 @@ reap;
connection slave;
# The SQL slave thread should now have stopped because the query was killed on
# the master (so it has a non-zero error code in the binlog).
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
# The following test can't be done because the result of Pos will differ
# on different computers
......
......@@ -24,7 +24,7 @@ insert into t1 values(1),(2);
drop table t1;
save_master_pos;
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
# End of 4.1 tests
###################################################
#Author: Jeb
#Date: 2007-06-11
#Purpose: used for io errors on the slave. If Slave gets an io
# error, the io trhead should stop
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for
# sql threads to stop
# 3) If loops too long die.
####################################################
connection slave;
let $my_show= SHOW SLAVE STATUS;
let $sql_running= Slave_IO_Running;
let $row_number= 1;
let $run= 1;
let $counter= 300;
while ($run)
{
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
if (`SELECT '$io_result' = 'No'`){
let $run= 0;
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave IO thread to stop"
SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
###################################################
#Author: Jeb
#Date: 2007-06-11
#Purpose: used for SQL errors on the slave. If Slave gets a sql
# error, the SQL trhead should stop
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for
# sql threads to stop
# 3) If loops too long die.
####################################################
connection slave;
let $row_number= 1;
let $run= 1;
let $counter= 300;
while ($run)
{
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
if (`SELECT '$sql_result' = 'No'`){
let $run= 0;
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave SQL thread to stop"
SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
###################################################
#Author: Jeb
#Date: 2007-06-11
#Purpose: To wait a brief time for slave to start
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for both
# io and sql threads to start
# 3) If loops too long die.
####################################################
connection slave;
let $row_number= 1;
let $run= 1;
let $counter= 300;
while ($run)
{
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
if (`SELECT '$io_result' = 'Yes'`){
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
if (`SELECT '$sql_result' = 'Yes'`){
let $run= 0;
}
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave to start"
SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
###################################################
#Author: Jeb
#Date: 2007-06-11
#Purpose: To replace the mysqltest.c executable
# wait_for_slave_to_stop function and
# return this to the test language.
#Details:
# 1) Fill in and setup variables
# 2) loop through looking for both
# io and sql threads to stop
# 3) If loops too long die.
####################################################
connection slave;
let $row_number= 1;
let $run= 1;
let $counter= 300;
while ($run)
{
let $io_result= query_get_value("SHOW SLAVE STATUS", Slave_IO_Running, $row_number);
if (`SELECT '$io_result' = 'No'`){
let $sql_result= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running, $row_number);
if (`SELECT '$sql_result' = 'No'`){
let $run= 0;
}
}
sleep 0.1;
if (!$counter){
--echo "Failed while waiting for slave to stop"
SHOW SLAVE STATUS;
exit;
}
dec $counter;
}
......@@ -53,7 +53,7 @@ connection slave;
# Here the slave will only stop if the query above actually started
# inserting some rows into t2. Otherwise, it will hang forever.
wait_for_slave_to_stop;
--source include/wait_for_slave_to_stop.inc
# The following should be 0
SELECT COUNT(*) FROM t2;
......
......@@ -61,7 +61,7 @@ sync_with_master;
# select master_pos_wait("slave-bin.000001",137);
# wait_for_slave_to_stop;
# --source include/wait_for_slave_to_stop.inc
# then BUG#13861 causes t3 to show up below (because stopped too
# late).
......
......@@ -25,7 +25,7 @@ connection master;
INSERT INTO t1(b) VALUES(1),(1),(2) ON DUPLICATE KEY UPDATE t1.b=10;
SELECT * FROM t1;
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_to_stop.inc
# show the error message
--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
--query_vertical show slave status;
......@@ -79,7 +79,7 @@ ON DUPLICATE KEY UPDATE
t1.field_3 = t2.field_c;
SELECT * FROM t1;
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_to_stop.inc
# show the error message
--replace_column 1 # 4 # 7 # 8 # 9 # 23 # 33 #
--query_vertical show slave status;
......
......@@ -96,7 +96,7 @@ connection master;
set insert_id=1234;
insert into t2 values(NULL);
connection slave;
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
#restart slave skipping one event
set global sql_slave_skip_counter=1;
......
......@@ -23,7 +23,7 @@ insert into t1 values (1);
connection slave;
# slave should have stopped because can't find table t1
wait_for_slave_to_stop;
--source include/wait_for_slave_sql_to_stop.inc
# see if we have a good error message:
--replace_result $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment