Commit f299da89 authored by Sergei Golubchik's avatar Sergei Golubchik

rpl.rpl_parallel: after-merge fix

* fix the test to pass
* rearrange tests in a file to allow it to auto-merge in the future
parent 4b21cd21
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first ERROR HY000: This operation cannot be performed as you have a running slave ''; run STOP SLAVE '' first
include/stop_slave.inc include/stop_slave.inc
...@@ -923,61 +924,6 @@ a ...@@ -923,61 +924,6 @@ a
32 32
33 33
34 34
*** MDEV-6676 - test syntax of @@slave_parallel_mode ***
Parallel_Mode = 'domain,follow_master_commit'
include/stop_slave.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit,transactional';
ERROR HY000: Invalid use of 'transactional' option for slave_parallel_mode
SET GLOBAL slave_parallel_mode='waiting,transactional,domain';
Parallel_Mode = 'domain,transactional,waiting'
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
Parallel_Mode = 'domain,follow_master_commit'
*** MDEV-6676 - test that empty parallel_mode does not replicate in parallel ***
INSERT INTO t2 VALUES (40);
include/save_master_gtid.inc
SET GLOBAL slave_parallel_mode='';
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply";
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
a
40
include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
*** MDEV-6676 - test disabling domain-based parallel replication ***
SET gtid_domain_id = 1;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (46);
DELETE FROM t2 WHERE a >= 41;
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (46);
SET gtid_domain_id = 0;
include/save_master_gtid.inc
SET GLOBAL slave_parallel_mode=follow_master_commit;
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
a
40
41
42
43
44
45
46
include/stop_slave.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
include/start_slave.inc
*** MDEV-6775: Wrong binlog order in parallel replication *** *** MDEV-6775: Wrong binlog order in parallel replication ***
DELETE FROM t4; DELETE FROM t4;
INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6); INSERT INTO t4 VALUES (1,NULL), (3,NULL), (4,4), (5, NULL), (6, 6);
...@@ -1028,7 +974,7 @@ SET GLOBAL slave_parallel_threads=0; ...@@ -1028,7 +974,7 @@ SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
include/start_slave.inc include/start_slave.inc
*** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave *** *** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave ***
INSERT INTO t2 VALUES (50); INSERT INTO t2 VALUES (40);
include/stop_slave.inc include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=no; CHANGE MASTER TO master_use_gtid=no;
SET @old_dbug= @@GLOBAL.debug_dbug; SET @old_dbug= @@GLOBAL.debug_dbug;
...@@ -1036,41 +982,41 @@ SET GLOBAL debug_dbug="+d,rpl_parallel_scheduled_gtid_0_x_100"; ...@@ -1036,41 +982,41 @@ SET GLOBAL debug_dbug="+d,rpl_parallel_scheduled_gtid_0_x_100";
SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger"; SET GLOBAL debug_dbug="+d,rpl_parallel_wait_for_done_trigger";
SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
INSERT INTO t2 VALUES (51); INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (52); INSERT INTO t2 VALUES (42);
SET @old_format= @@binlog_format; SET @old_format= @@binlog_format;
SET binlog_format= statement; SET binlog_format= statement;
DELETE FROM t2 WHERE a=50; DELETE FROM t2 WHERE a=40;
SET binlog_format= @old_format; SET binlog_format= @old_format;
INSERT INTO t2 VALUES (53); INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (54); INSERT INTO t2 VALUES (44);
FLUSH LOGS; FLUSH LOGS;
INSERT INTO t2 VALUES (55); INSERT INTO t2 VALUES (45);
SET gtid_seq_no=100; SET gtid_seq_no=100;
INSERT INTO t2 VALUES (56); INSERT INTO t2 VALUES (46);
BEGIN; BEGIN;
SELECT * FROM t2 WHERE a=50 FOR UPDATE; SELECT * FROM t2 WHERE a=40 FOR UPDATE;
a a
50 40
include/start_slave.inc include/start_slave.inc
SET debug_sync= 'now WAIT_FOR scheduled_gtid_0_x_100'; SET debug_sync= 'now WAIT_FOR scheduled_gtid_0_x_100';
STOP SLAVE; STOP SLAVE;
SET debug_sync= 'now WAIT_FOR wait_for_done_waiting'; SET debug_sync= 'now WAIT_FOR wait_for_done_waiting';
ROLLBACK; ROLLBACK;
include/wait_for_slave_sql_to_stop.inc include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t2 WHERE a >= 50 ORDER BY a; SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
a a
51 41
52 42
include/start_slave.inc include/start_slave.inc
SELECT * FROM t2 WHERE a >= 50 ORDER BY a; SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
a a
51 41
52 42
53 43
54 44
55 45
56 46
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug; SET GLOBAL debug_dbug=@old_dbug;
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
...@@ -1191,8 +1137,63 @@ SET GLOBAL debug_dbug=@old_dbug; ...@@ -1191,8 +1137,63 @@ SET GLOBAL debug_dbug=@old_dbug;
SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
include/start_slave.inc include/start_slave.inc
*** MDEV-6676 - test syntax of @@slave_parallel_mode ***
Parallel_Mode = 'domain,follow_master_commit'
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL slave_parallel_threads=0; SET GLOBAL slave_parallel_mode='domain,follow_master_commit,transactional';
ERROR HY000: Invalid use of 'transactional' option for slave_parallel_mode
SET GLOBAL slave_parallel_mode='waiting,transactional,domain';
Parallel_Mode = 'domain,transactional,waiting'
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
Parallel_Mode = 'domain,follow_master_commit'
*** MDEV-6676 - test that empty parallel_mode does not replicate in parallel ***
INSERT INTO t2 VALUES (1040);
include/save_master_gtid.inc
SET GLOBAL slave_parallel_mode='';
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply";
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 1040 ORDER BY a;
a
1040
include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
*** MDEV-6676 - test disabling domain-based parallel replication ***
SET gtid_domain_id = 1;
INSERT INTO t2 VALUES (1041);
INSERT INTO t2 VALUES (1042);
INSERT INTO t2 VALUES (1043);
INSERT INTO t2 VALUES (1044);
INSERT INTO t2 VALUES (1045);
INSERT INTO t2 VALUES (1046);
DELETE FROM t2 WHERE a >= 1041;
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (1041);
INSERT INTO t2 VALUES (1042);
INSERT INTO t2 VALUES (1043);
INSERT INTO t2 VALUES (1044);
INSERT INTO t2 VALUES (1045);
INSERT INTO t2 VALUES (1046);
SET gtid_domain_id = 0;
include/save_master_gtid.inc
SET GLOBAL slave_parallel_mode=follow_master_commit;
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 1040 ORDER BY a;
a
1040
1041
1042
1043
1044
1045
1046
include/stop_slave.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
include/start_slave.inc
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=@old_parallel_threads;
include/start_slave.inc include/start_slave.inc
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
DROP function foo; DROP function foo;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# Test various aspects of parallel replication. # Test various aspects of parallel replication.
--connection server_2 --connection server_2
--let $old_parallel_threads=`SELECT @@GLOBAL.slave_parallel_threads` SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
--error ER_SLAVE_MUST_STOP --error ER_SLAVE_MUST_STOP
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
--source include/stop_slave.inc --source include/stop_slave.inc
...@@ -1465,71 +1465,6 @@ SET sql_slave_skip_counter= 1; ...@@ -1465,71 +1465,6 @@ SET sql_slave_skip_counter= 1;
SELECT * FROM t2 WHERE a >= 30 ORDER BY a; SELECT * FROM t2 WHERE a >= 30 ORDER BY a;
--echo *** MDEV-6676 - test syntax of @@slave_parallel_mode ***
--connection server_2
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
--source include/stop_slave.inc
--error ER_INVALID_SLAVE_PARALLEL_MODE
SET GLOBAL slave_parallel_mode='domain,follow_master_commit,transactional';
SET GLOBAL slave_parallel_mode='waiting,transactional,domain';
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
--echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel ***
--connection server_1
INSERT INTO t2 VALUES (40);
--source include/save_master_gtid.inc
--connection server_2
SET GLOBAL slave_parallel_mode='';
# Test that we do not use parallel apply, by injecting an unconditional
# crash in the parallel apply code.
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply";
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
--echo *** MDEV-6676 - test disabling domain-based parallel replication ***
--connection server_1
# Let's do a bunch of transactions that will conflict if run out-of-order in
# domain-based parallel replication mode.
SET gtid_domain_id = 1;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (46);
DELETE FROM t2 WHERE a >= 41;
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (42);
INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (44);
INSERT INTO t2 VALUES (45);
INSERT INTO t2 VALUES (46);
SET gtid_domain_id = 0;
--source include/save_master_gtid.inc
--connection server_2
SET GLOBAL slave_parallel_mode=follow_master_commit;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
--source include/start_slave.inc
--echo *** MDEV-6775: Wrong binlog order in parallel replication *** --echo *** MDEV-6775: Wrong binlog order in parallel replication ***
--connection server_1 --connection server_1
# A bit tricky bug to reproduce. On the master, we binlog in statement-mode # A bit tricky bug to reproduce. On the master, we binlog in statement-mode
...@@ -1601,7 +1536,7 @@ SET GLOBAL slave_parallel_threads=10; ...@@ -1601,7 +1536,7 @@ SET GLOBAL slave_parallel_threads=10;
--echo *** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave *** --echo *** MDEV-7237: Parallel replication: incorrect relaylog position after stop/start the slave ***
--connection server_1 --connection server_1
INSERT INTO t2 VALUES (50); INSERT INTO t2 VALUES (40);
--save_master_pos --save_master_pos
--connection server_2 --connection server_2
...@@ -1622,28 +1557,28 @@ SET GLOBAL slave_parallel_threads=10; ...@@ -1622,28 +1557,28 @@ SET GLOBAL slave_parallel_threads=10;
--connection server_1 --connection server_1
# Setup some transaction for the slave to replicate. # Setup some transaction for the slave to replicate.
INSERT INTO t2 VALUES (51); INSERT INTO t2 VALUES (41);
INSERT INTO t2 VALUES (52); INSERT INTO t2 VALUES (42);
# Need to log the DELETE in statement format, so we can see it in processlist. # Need to log the DELETE in statement format, so we can see it in processlist.
SET @old_format= @@binlog_format; SET @old_format= @@binlog_format;
SET binlog_format= statement; SET binlog_format= statement;
DELETE FROM t2 WHERE a=50; DELETE FROM t2 WHERE a=40;
SET binlog_format= @old_format; SET binlog_format= @old_format;
INSERT INTO t2 VALUES (53); INSERT INTO t2 VALUES (43);
INSERT INTO t2 VALUES (54); INSERT INTO t2 VALUES (44);
# Force the slave to switch to a new relay log file. # Force the slave to switch to a new relay log file.
FLUSH LOGS; FLUSH LOGS;
INSERT INTO t2 VALUES (55); INSERT INTO t2 VALUES (45);
# Inject a GTID 0-1-100, which will trigger a DEBUG_SYNC signal when this # Inject a GTID 0-1-100, which will trigger a DEBUG_SYNC signal when this
# transaction has been fetched by a worker thread. # transaction has been fetched by a worker thread.
SET gtid_seq_no=100; SET gtid_seq_no=100;
INSERT INTO t2 VALUES (56); INSERT INTO t2 VALUES (46);
--save_master_pos --save_master_pos
--connection con_temp2 --connection con_temp2
# Temporarily block the DELETE on a=40 from completing. # Temporarily block the DELETE on a=40 from completing.
BEGIN; BEGIN;
SELECT * FROM t2 WHERE a=50 FOR UPDATE; SELECT * FROM t2 WHERE a=40 FOR UPDATE;
--connection server_2 --connection server_2
...@@ -1651,7 +1586,7 @@ SELECT * FROM t2 WHERE a=50 FOR UPDATE; ...@@ -1651,7 +1586,7 @@ SELECT * FROM t2 WHERE a=50 FOR UPDATE;
# Wait for a worker thread to start on the DELETE that will be blocked # Wait for a worker thread to start on the DELETE that will be blocked
# temporarily by the SELECT FOR UPDATE. # temporarily by the SELECT FOR UPDATE.
--let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state='updating' and info LIKE '%DELETE FROM t2 WHERE a=50%' --let $wait_condition= SELECT count(*) > 0 FROM information_schema.processlist WHERE state='updating' and info LIKE '%DELETE FROM t2 WHERE a=40%'
--source include/wait_condition.inc --source include/wait_condition.inc
# The DBUG injection set above will make the worker thread signal the following # The DBUG injection set above will make the worker thread signal the following
...@@ -1684,13 +1619,13 @@ ROLLBACK; ...@@ -1684,13 +1619,13 @@ ROLLBACK;
--connection server_2 --connection server_2
reap; reap;
--source include/wait_for_slave_sql_to_stop.inc --source include/wait_for_slave_sql_to_stop.inc
SELECT * FROM t2 WHERE a >= 50 ORDER BY a; SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
# Now restart the slave. With the bug present, this would start at an # Now restart the slave. With the bug present, this would start at an
# incorrect relay log position, causing relay log read error (or if unlucky, # incorrect relay log position, causing relay log read error (or if unlucky,
# silently skip a number of events). # silently skip a number of events).
--source include/start_slave.inc --source include/start_slave.inc
--sync_with_master --sync_with_master
SELECT * FROM t2 WHERE a >= 50 ORDER BY a; SELECT * FROM t2 WHERE a >= 40 ORDER BY a;
--source include/stop_slave.inc --source include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug; SET GLOBAL debug_dbug=@old_dbug;
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
...@@ -1906,11 +1841,75 @@ SET GLOBAL slave_parallel_threads=0; ...@@ -1906,11 +1841,75 @@ SET GLOBAL slave_parallel_threads=0;
SET GLOBAL slave_parallel_threads=10; SET GLOBAL slave_parallel_threads=10;
--source include/start_slave.inc --source include/start_slave.inc
--echo *** MDEV-6676 - test syntax of @@slave_parallel_mode ***
--connection server_2
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
--source include/stop_slave.inc
--error ER_INVALID_SLAVE_PARALLEL_MODE
SET GLOBAL slave_parallel_mode='domain,follow_master_commit,transactional';
SET GLOBAL slave_parallel_mode='waiting,transactional,domain';
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
--let $status_items= Parallel_Mode
--source include/show_slave_status.inc
--echo *** MDEV-6676 - test that empty parallel_mode does not replicate in parallel ***
--connection server_1
INSERT INTO t2 VALUES (1040);
--source include/save_master_gtid.inc
--connection server_2
SET GLOBAL slave_parallel_mode='';
# Test that we do not use parallel apply, by injecting an unconditional
# crash in the parallel apply code.
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_crash_if_parallel_apply";
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 1040 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL debug_dbug=@old_dbug;
--echo *** MDEV-6676 - test disabling domain-based parallel replication ***
--connection server_1
# Let's do a bunch of transactions that will conflict if run out-of-order in
# domain-based parallel replication mode.
SET gtid_domain_id = 1;
INSERT INTO t2 VALUES (1041);
INSERT INTO t2 VALUES (1042);
INSERT INTO t2 VALUES (1043);
INSERT INTO t2 VALUES (1044);
INSERT INTO t2 VALUES (1045);
INSERT INTO t2 VALUES (1046);
DELETE FROM t2 WHERE a >= 1041;
SET gtid_domain_id = 2;
INSERT INTO t2 VALUES (1041);
INSERT INTO t2 VALUES (1042);
INSERT INTO t2 VALUES (1043);
INSERT INTO t2 VALUES (1044);
INSERT INTO t2 VALUES (1045);
INSERT INTO t2 VALUES (1046);
SET gtid_domain_id = 0;
--source include/save_master_gtid.inc
--connection server_2
SET GLOBAL slave_parallel_mode=follow_master_commit;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
SELECT * FROM t2 WHERE a >= 1040 ORDER BY a;
--source include/stop_slave.inc
SET GLOBAL slave_parallel_mode='domain,follow_master_commit';
--source include/start_slave.inc
# Clean up. # Clean up.
--connection server_2 --connection server_2
--source include/stop_slave.inc --source include/stop_slave.inc
eval SET GLOBAL slave_parallel_threads=$old_parallel_threads; SET GLOBAL slave_parallel_threads=@old_parallel_threads;
--source include/start_slave.inc --source include/start_slave.inc
SET DEBUG_SYNC= 'RESET'; SET DEBUG_SYNC= 'RESET';
......
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