1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
################################################################################
# Test executing dependent DDL(s) and DML(s) on same member but in different
# sessions in group replication environment:
# i) one after the other ii) in parallel
# Scenario:
# 0. Start 2 servers with GR
# 1. Create a table (t1), Insert some data
# 2. Execute dependent DDL and DML (one after the other) in different sessions
# of server1. Verify data in the group.
# 3. Execute dependent DDL and DML (in parallel) in different sessions of
# server1. Verify data in the group.
# 4. Clean-up
################################################################################
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc
--echo
--echo #1. Create table, insert some data
--echo
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 (a) VALUES (10),(20);
--source include/rpl_sync.inc
--echo
--echo #2. Execute dependent DDL and DML (one after the other)
--echo # in different sessions, on same member
--echo
# 2.1 Perform some DMLs on a session in server1
BEGIN;
INSERT INTO t1 (a) values (30);
UPDATE t1 set a= 1 where a= 10;
DELETE FROM t1 WHERE a= 20;
UPDATE t1 set a= 3 where a= 30;
COMMIT;
# 2.2 Perform some DDLs on server_1
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
ALTER TABLE t1 add column b varchar(10) DEFAULT 'empty';
--source include/rpl_sync.inc
SELECT * FROM t1;
--echo # 2.3 Check that t1 on Server1, Server2 has same data
--let $diff_tables= server1:test.t1, server2:test.t1
--source include/diff_tables.inc
--echo
--echo # 3. Execute dependent DDL and DML (concurrently)
--echo # in different sessions, on same member
--echo
# 3.1 Perform some DMLs on a session in server1 (but not committed)
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
BEGIN;
INSERT INTO t1 (a,b) values (2, 'two');
UPDATE t1 set b= 'one' WHERE a= 1;
UPDATE t1 set b= 'three' WHERE a=3;
# 3.2 Perform some DDLs on server_1
# This is blocked until the transaction (which is incomplete) is
# completed on other session.
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
SELECT * FROM t1;
--send ALTER TABLE t1 DROP b
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
COMMIT;
# Check the contents of the table after reap.
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--reap
SELECT * FROM t1;
--source include/rpl_sync.inc
--echo # 3.3 Check that t1 on Server1, Server2 has same data
--let $diff_tables= server1:test.t1, server2:test.t1
--source include/diff_tables.inc
# Clean-up
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
DROP TABLE t1;
--source include/group_replication_end.inc
|