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 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
################################################################################
# Validate group_replication_consistency= 'AFTER' behaviour when executed
# concurrently with STOP GROUP_REPLICATION.
#
# Test:
# 00. The test requires two servers: M1 and M2.
# 01. Create two tables on the group.
# 02. Force server2 to block between T1 prepare and commit.
# 03. Execute transaction T1.
# 04. Wait for server2 to block between T1 prepare and commit.
# 05. Stop the plugin on server2.
# 06. Execute transaction T2, it will not be allowed to
# execute since plugin is stopping, otherwise there may
# be a deadlock on the waiting conditions.
# 07. Unblock T1 prepare on server2.
# 08. Resume the plugin stop.
# 09. Resume transaction T1.
# 10. Clean up.
################################################################################
--source include/have_debug_sync.inc
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc
--echo
--echo ############################################################
--echo # 01. Create two tables on the group.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @@SESSION.group_replication_consistency= 'AFTER';
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY);
--echo
--echo ############################################################
--echo # 02. Force server2 to block between T1 prepare and commit.
--let $rpl_connection_name= server_2_1
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG= '+d,group_replication_wait_on_after_applier_prepare';
--echo
--echo ############################################################
--echo # 03. Execute transaction T1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
BEGIN;
INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
--send COMMIT
--echo
--echo ############################################################
--echo # 04. Wait for server2 to block between T1 prepare and commit.
--let $rpl_connection_name= server_2_1
--source include/rpl_connection.inc
SET DEBUG_SYNC= "now WAIT_FOR signal.after_applier_prepare_waiting";
--echo
--echo ############################################################
--echo # 05. Stop the plugin on server2.
--let $rpl_connection_name= server_2_1
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG= '+d,group_replication_hold_stop_before_leave_the_group';
--send STOP GROUP_REPLICATION
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State='debug sync point: now' AND Info='STOP GROUP_REPLICATION'
--source include/wait_condition.inc
--echo
--echo ############################################################
--echo # 06. Execute transaction T2, it will not be allowed to
--echo # execute since plugin is stopping, otherwise there may
--echo # be a deadlock on the waiting conditions.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--error ER_GRP_TRX_CONSISTENCY_BEGIN_NOT_ALLOWED
SELECT * FROM t1;
--echo
--echo ############################################################
--echo # 07. Unblock T1 prepare on server2.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
# Signal debug sync to continue.
SET DEBUG_SYNC= 'now SIGNAL signal.after_applier_prepare_continue';
SET @@GLOBAL.DEBUG= '-d,group_replication_wait_on_after_applier_prepare';
--echo
--echo ############################################################
--echo # 08. Resume the plugin stop.
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET DEBUG_SYNC= "now SIGNAL signal.resume_stop_before_leave_the_group";
SET @@GLOBAL.DEBUG= '-d,group_replication_hold_stop_before_leave_the_group';
--let $rpl_connection_name= server_2_1
--source include/rpl_connection.inc
--reap
--let $group_replication_member_state= OFFLINE
--source include/gr_wait_for_member_state.inc
--source include/assert_and_disable_read_only.inc
--echo
--echo ############################################################
--echo # 09. Resume transaction T1.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--reap
--echo
--echo ############################################################
--echo # 10. Clean up.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @@SESSION.group_replication_consistency= DEFAULT;
DROP TABLE t1;
DROP TABLE t2;
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
DROP TABLE t1;
DROP TABLE t2;
--source include/group_replication_end.inc
|