diff options
Diffstat (limited to 'mysql-test/extra/rpl_tests')
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test | 118 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_row_sp003.test | 18 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_start_stop_slave.test | 56 | ||||
-rw-r--r-- | mysql-test/extra/rpl_tests/rpl_stop_slave.test | 61 |
4 files changed, 217 insertions, 36 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test index 1fb6b3dcb8a..3d97ad10d17 100644 --- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test +++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test @@ -21,9 +21,18 @@ # and slave are diverging. # ######################################################################################## - call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1); +let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1); + +SET GLOBAL max_binlog_cache_size = 4096; +# Becuase of bug#55377, we have to set binlog_cache_size until the bug is +# fixed. +SET GLOBAL binlog_cache_size = 4096; +disconnect master; +connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); + CREATE TABLE t1(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; CREATE TABLE t2(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=MyIsam; CREATE TABLE t3(a INT PRIMARY KEY, data VARCHAR(30000)) ENGINE=Innodb; @@ -50,13 +59,9 @@ eval INSERT INTO t2 (a, data) VALUES (2, CONCAT($data, $data, $data, $data, $data, $data)); --enable_query_log -connection slave; ---source include/wait_for_slave_sql_to_stop.inc -SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; -START SLAVE SQL_THREAD; ---source include/wait_for_slave_sql_to_start.inc - -connection master; +# Incident event +--let $slave_sql_errno=1590 +--source include/wait_for_slave_sql_error_and_skip.inc --disable_query_log eval INSERT INTO t1 (a, data) VALUES (3, $data); @@ -74,23 +79,15 @@ eval UPDATE t2, t1 SET t2.data = CONCAT($data, $data, $data, $data), t1.data = CONCAT($data, $data, $data, $data); --enable_query_log -connection slave; ---source include/wait_for_slave_sql_to_stop.inc - -if (`SELECT @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`) -{ - SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; -} +# Incident event +--let $slave_skip_counter=1 if (`SELECT @@binlog_format = 'ROW'`) { - SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 2; + --inc $slave_skip_counter } -START SLAVE SQL_THREAD; ---source include/wait_for_slave_sql_to_start.inc -connection master; - -let $diff_statement= SELECT * FROM t1; ---source include/diff_master_slave.inc +--let $slave_sql_errno=1590 +--source include/wait_for_slave_sql_error_and_skip.inc +--let $slave_skip_counter= --echo ######################################################################################## --echo # 2 - BEGIN - IMPLICIT COMMIT by DDL @@ -178,17 +175,6 @@ BEGIN; CREATE TABLE t5 (a int); --enable_query_log -if (`SELECT @@binlog_format = 'ROW'`) -{ - connection slave; - --source include/wait_for_slave_sql_to_stop.inc - - SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1; - START SLAVE SQL_THREAD; - --source include/wait_for_slave_sql_to_start.inc - connection master; -} - let $diff_statement= SELECT * FROM t1; --source include/diff_master_slave.inc @@ -373,6 +359,70 @@ COMMIT; let $diff_statement= SELECT * FROM t1; --source include/diff_master_slave.inc +--echo ######################################################################## +--echo # 8 - Bug#55375(Regression Bug) Transaction bigger than +--echo # max_binlog_cache_size crashes slave +--echo ######################################################################## + +--echo # [ On Slave ] +SET GLOBAL max_binlog_cache_size = 4096; +SET GLOBAL binlog_cache_size = 4096; + +source include/stop_slave.inc; +source include/start_slave.inc; +CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*"); +CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*"); + +connection master; +TRUNCATE t1; + +sync_slave_with_master; +--let binlog_start= query_get_value(SHOW MASTER STATUS, Position, 1) +--let binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) + +connection master; +--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size +--replace_result $old_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size +disconnect master; +connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); + +--let $n=128 +BEGIN; +--disable_query_log +--echo Repeat statement 'INSERT INTO t1 VALUES(\$n, repeat("a", 32))' $n times +while ($n) +{ + --eval INSERT INTO t1 VALUES ($n, repeat("a", 32)) + --dec $n +} +--enable_query_log +COMMIT; + +connection slave; +--let $slave_sql_errno= 1197 +if (`SELECT @@binlog_format = 'ROW'`) +{ + --let $slave_sql_errno= 1534 +} +source include/wait_for_slave_sql_error.inc; + +SELECT count(*) FROM t1; +source include/show_binlog_events.inc; + +--replace_result $old_max_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL max_binlog_cache_size= $old_max_binlog_cache_size +--replace_result $old_binlog_cache_size ORIGINAL_VALUE +--eval SET GLOBAL binlog_cache_size= $old_binlog_cache_size + +source include/stop_slave.inc; +source include/start_slave.inc; + +connection master; +sync_slave_with_master; +SELECT count(*) FROM t1; + --echo ######################################################################################## --echo # CLEAN --echo ######################################################################################## @@ -385,4 +435,4 @@ DROP TABLE IF EXISTS t4; DROP TABLE IF EXISTS t5; DROP TABLE IF EXISTS t6; DROP PROCEDURE p1; -sync_slave_with_master; +source include/master-slave-end.inc; diff --git a/mysql-test/extra/rpl_tests/rpl_row_sp003.test b/mysql-test/extra/rpl_tests/rpl_row_sp003.test index 7bc326a3791..d2c2ea0caf3 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test +++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test @@ -35,10 +35,23 @@ connection master1; send CALL test.p1(); connection master; -# To make sure tha the call on master1 arrived at the get_lock -sleep 1; +# Make sure that the call on master1 arrived at the get_lock. +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'User lock' and + info = 'SELECT get_lock("test", 100)'; +--source include/wait_condition.inc CALL test.p2(); SELECT release_lock("test"); + +connection master1; +# Reap CALL test.p1() to ensure that it has fully completed +# before doing any selects on test.t1. +--reap +# Release lock acquired by it. +SELECT release_lock("test"); + +connection master; SELECT * FROM test.t1; #show binlog events; --source include/wait_for_ndb_to_binlog.inc @@ -51,6 +64,7 @@ DROP TABLE IF EXISTS test.t1; eval CREATE TABLE test.t1(a INT,PRIMARY KEY(a))ENGINE=$engine_type; CALL test.p2(); CALL test.p1(); +SELECT release_lock("test"); SELECT * FROM test.t1; sync_slave_with_master; diff --git a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test index 05836737717..5c99fa1bc74 100644 --- a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test +++ b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test @@ -122,4 +122,60 @@ drop table t1i, t2m; sync_slave_with_master; +--echo # +--echo # Bug#56096 STOP SLAVE hangs if executed in parallel with user sleep +--echo # + +--connection master + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT ); + +sync_slave_with_master; + +--connection slave1 +--echo # Slave1: lock table for synchronization +LOCK TABLES t1 WRITE; + +--connection master +--echo # Master: insert into the table +INSERT INTO t1 SELECT SLEEP(4); + +--connection slave +--echo # Slave: wait for the insert +let $wait_condition= + SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE STATE = "Waiting for table metadata lock" + AND INFO = "INSERT INTO t1 SELECT SLEEP(4)"; +--source include/wait_condition.inc + +--echo # Slave: send slave stop +--send STOP SLAVE + +--connection slave1 +--echo # Slave1: wait for stop slave +let $wait_condition= + SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE INFO = "STOP SLAVE"; +--source include/wait_condition.inc + +--echo # Slave1: unlock the table +UNLOCK TABLES; + +--connection slave +--echo # Slave: wait for the slave to stop +--reap +--source include/wait_for_slave_to_stop.inc + +--echo # Start slave again +--source include/start_slave.inc + +--echo # Clean up +--connection master +DROP TABLE t1; +sync_slave_with_master; + # End of tests diff --git a/mysql-test/extra/rpl_tests/rpl_stop_slave.test b/mysql-test/extra/rpl_tests/rpl_stop_slave.test new file mode 100644 index 00000000000..7c88afe3532 --- /dev/null +++ b/mysql-test/extra/rpl_tests/rpl_stop_slave.test @@ -0,0 +1,61 @@ +# +# Auxiliary file which is used to test BUG#56118 +# +# Slave should apply all statements in the transaction before stop if any +# temporary table is created or dropped. +# +# USEAGE: +# --let $tmp_table_stm= a SQL statement +# --source extra/rpl_tests/rpl_stop_slave.test +# + +if (`SELECT "$tmp_table_stm" = ''`) +{ + --echo \$tmp_table_stm is NULL + --die $tmp_table_stm is NULL +} + +--echo +--echo [ On Master ] +connection master; +BEGIN; +DELETE FROM t1; +eval $tmp_table_stm; +INSERT INTO t1 VALUES (1); +DROP TEMPORARY TABLE tt1; +COMMIT; + +--echo +--echo [ On Slave ] +connection slave; + +# To check if slave SQL thread is applying INSERT statement +let $show_statement= SHOW PROCESSLIST; +let $field= Info; +let $condition= LIKE 'INSERT%'; +source include/wait_show_condition.inc; + +send STOP SLAVE SQL_THREAD; + +--echo +--echo [ On Slave1 ] +connection slave1; +--echo # To resume slave SQL thread +SET DEBUG_SYNC= 'now SIGNAL signal.continue'; +SET DEBUG_SYNC= 'RESET'; + +--echo +--echo [ On Slave ] +connection slave; +reap; +source include/wait_for_slave_sql_to_stop.inc; + +--echo # Slave should stop after the transaction has committed. +--echo # So t1 on master is same to t1 on slave. +let diff_table_1=master:test.t1; +let diff_table_2=slave:test.t1; +source include/diff_tables.inc; + +connection slave; +START SLAVE SQL_THREAD; +source include/wait_for_slave_sql_to_start.inc; |