213 lines
5.5 KiB
Plaintext
213 lines
5.5 KiB
Plaintext
# Every statement in this test is either executing under ROW or
|
|
# STATEMENT format, which requires the slave thread to be able to apply
|
|
# both statement and row events. Hence, we only need to execute this
|
|
# test for MIXED mode.
|
|
# Skip in valgrind because of bug#20952953
|
|
--source include/not_valgrind.inc
|
|
source include/have_binlog_format_mixed.inc;
|
|
# UNTIL is not supported yet (TODO: support and remove the guard)
|
|
-- source include/not_mts_slave_parallel_workers.inc
|
|
|
|
source include/master-slave.inc;
|
|
|
|
--echo **** On Slave ****
|
|
connection slave;
|
|
|
|
STOP SLAVE;
|
|
--source include/wait_for_slave_to_stop.inc
|
|
|
|
--echo **** On Master ****
|
|
connection master;
|
|
SET SESSION BINLOG_FORMAT='ROW';
|
|
|
|
CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
|
|
CREATE TABLE t2 (c INT, d INT) ENGINE=MyISAM;
|
|
INSERT INTO t1 VALUES (1,1),(2,4),(3,9);
|
|
INSERT INTO t2 VALUES (1,1),(2,8),(3,27);
|
|
let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
|
|
UPDATE t1,t2 SET b = d, d = b * 2 WHERE a = c;
|
|
source include/show_binlog_events.inc;
|
|
|
|
# These tables should be changed
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
save_master_pos;
|
|
--echo **** On Slave ****
|
|
connection slave;
|
|
|
|
# Stop when reaching the the first table map event.
|
|
--replace_result $master_log_pos MASTER_LOG_POS
|
|
eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_log_pos;
|
|
source include/wait_for_slave_sql_to_stop.inc;
|
|
let $slave_param= Exec_Master_Log_Pos;
|
|
let $slave_param_value= $master_log_pos;
|
|
source include/check_slave_param.inc;
|
|
source include/check_slave_no_error.inc;
|
|
|
|
# Now we skip *one* table map event. If the execution starts right
|
|
# after that table map event, *one* of the involved tables will be
|
|
# changed.
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
START SLAVE;
|
|
--source include/wait_for_slave_to_start.inc
|
|
sync_with_master;
|
|
|
|
# These values should be what was inserted, not what was
|
|
# updated. Since we are skipping the first table map of the group
|
|
# representing the UPDATE statement above, we should skip the entire
|
|
# group and not start executing at the first table map.
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
|
|
STOP SLAVE;
|
|
--source include/wait_for_slave_to_stop.inc
|
|
RESET SLAVE;
|
|
connection master;
|
|
RESET MASTER;
|
|
|
|
SET SESSION BINLOG_FORMAT=STATEMENT;
|
|
SET @foo = 12;
|
|
let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
|
|
INSERT INTO t1 VALUES(@foo, 2*@foo);
|
|
save_master_pos;
|
|
source include/show_binlog_events.inc;
|
|
|
|
connection slave;
|
|
--replace_result $master_log_pos MASTER_LOG_POS
|
|
eval START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=$master_log_pos;
|
|
source include/wait_for_slave_sql_to_stop.inc;
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
START SLAVE;
|
|
--source include/wait_for_slave_to_start.inc
|
|
sync_with_master;
|
|
|
|
--echo **** On Master ****
|
|
connection master;
|
|
DROP TABLE t1, t2;
|
|
--source include/sync_slave_sql_with_master.inc
|
|
|
|
#
|
|
# More tests for BUG#28618
|
|
#
|
|
--echo **** Case 2: Row binlog format and transactional tables ****
|
|
|
|
# Create the transaction and try to skip some
|
|
# queries from one.
|
|
|
|
--echo *** On Master ***
|
|
connection master;
|
|
CREATE TABLE t4 (a INT, b VARCHAR(20)) ENGINE=XENGINE;
|
|
CREATE TABLE t5 (a INT, b VARCHAR(20)) ENGINE=XENGINE;
|
|
CREATE TABLE t6 (a INT, b VARCHAR(20)) ENGINE=XENGINE;
|
|
|
|
--echo **** On Slave ****
|
|
--source include/sync_slave_sql_with_master.inc
|
|
source include/stop_slave.inc;
|
|
|
|
--echo *** On Master ***
|
|
connection master;
|
|
BEGIN;
|
|
INSERT INTO t4 VALUES (2, 'master only');
|
|
INSERT INTO t5 VALUES (2, 'master only');
|
|
INSERT INTO t6 VALUES (2, 'master only');
|
|
COMMIT;
|
|
|
|
BEGIN;
|
|
INSERT INTO t4 VALUES (3, 'master/slave');
|
|
INSERT INTO t5 VALUES (3, 'master/slave');
|
|
INSERT INTO t6 VALUES (3, 'master/slave');
|
|
COMMIT;
|
|
|
|
SELECT * FROM t4 ORDER BY a;
|
|
SELECT * FROM t5 ORDER BY a;
|
|
SELECT * FROM t6 ORDER BY a;
|
|
|
|
save_master_pos;
|
|
|
|
--echo *** On Slave ***
|
|
connection slave;
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
source include/start_slave.inc;
|
|
sync_with_master;
|
|
|
|
SELECT * FROM t4 ORDER BY a;
|
|
SELECT * FROM t5 ORDER BY a;
|
|
SELECT * FROM t6 ORDER BY a;
|
|
|
|
# Test skipping two groups
|
|
|
|
--echo **** On Slave ****
|
|
connection slave;
|
|
source include/stop_slave.inc;
|
|
|
|
--echo *** On Master ***
|
|
connection master;
|
|
BEGIN;
|
|
INSERT INTO t4 VALUES (6, 'master only');
|
|
INSERT INTO t5 VALUES (6, 'master only');
|
|
INSERT INTO t6 VALUES (6, 'master only');
|
|
COMMIT;
|
|
|
|
BEGIN;
|
|
INSERT INTO t4 VALUES (7, 'master only');
|
|
INSERT INTO t5 VALUES (7, 'master only');
|
|
INSERT INTO t6 VALUES (7, 'master only');
|
|
COMMIT;
|
|
|
|
SELECT * FROM t4 ORDER BY a;
|
|
SELECT * FROM t5 ORDER BY a;
|
|
SELECT * FROM t6 ORDER BY a;
|
|
|
|
save_master_pos;
|
|
|
|
--echo *** On Slave ***
|
|
connection slave;
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=11;
|
|
source include/start_slave.inc;
|
|
sync_with_master;
|
|
|
|
SELECT * FROM t4 ORDER BY a;
|
|
SELECT * FROM t5 ORDER BY a;
|
|
SELECT * FROM t6 ORDER BY a;
|
|
|
|
#
|
|
# And the same, but with autocommit = 0
|
|
#
|
|
connection slave;
|
|
source include/stop_slave.inc;
|
|
|
|
connection master;
|
|
SET AUTOCOMMIT=0;
|
|
|
|
INSERT INTO t4 VALUES (4, 'master only');
|
|
INSERT INTO t5 VALUES (4, 'master only');
|
|
INSERT INTO t6 VALUES (4, 'master only');
|
|
COMMIT;
|
|
|
|
INSERT INTO t4 VALUES (5, 'master/slave');
|
|
INSERT INTO t5 VALUES (5, 'master/slave');
|
|
INSERT INTO t6 VALUES (5, 'master/slave');
|
|
COMMIT;
|
|
|
|
SELECT * FROM t4 ORDER BY a;
|
|
SELECT * FROM t5 ORDER BY a;
|
|
SELECT * FROM t6 ORDER BY a;
|
|
|
|
save_master_pos;
|
|
|
|
--echo *** On Slave ***
|
|
connection slave;
|
|
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
|
|
source include/start_slave.inc;
|
|
sync_with_master;
|
|
|
|
SELECT * FROM t4 ORDER BY a;
|
|
SELECT * FROM t5 ORDER BY a;
|
|
SELECT * FROM t6 ORDER BY a;
|
|
|
|
connection master;
|
|
DROP TABLE t4, t5, t6;
|
|
--source include/sync_slave_sql_with_master.inc
|
|
|
|
--source include/rpl_end.inc
|