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
|
################################################################################
# Validate that BEFORE can be used when there are lower version members on the
# group.
# Validate that AFTER and BEFORE_AND_AFTER can not be used when there are lower
# version members on the group.
#
# Test:
# 00. The test requires two servers: M1 and M2.
# 01. Create one table on the group.
# 02. Force that there is a lower version member.
# 03. Test BEFORE consistency, it is allowed.
# 04. Test AFTER consistency, it is not allowed.
# 05. Test BEFORE_AND_AFTER consistency, it is not allowed.
# 06. Validate data.
# 07. Clean up.
################################################################################
--source include/have_debug.inc
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc
--echo
--echo ############################################################
--echo # 01. Create one table on the group.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
--source include/rpl_sync.inc
--echo
--echo ############################################################
--echo # 02. Force that there is a lower version member.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG= '+d,group_replication_force_lower_version_on_group_replication_consistency';
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG= '+d,group_replication_force_lower_version_on_group_replication_consistency';
--echo
--echo ############################################################
--echo # 03. Test BEFORE consistency, it is allowed.
SET @@SESSION.group_replication_consistency= 'BEFORE';
INSERT INTO t1 VALUES (1);
--echo
--echo ############################################################
--echo # 04. Test AFTER consistency, it is not allowed.
SET @@SESSION.group_replication_consistency= 'AFTER';
--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT
INSERT INTO t1 VALUES (2);
--echo
--echo ############################################################
--echo # 05. Test BEFORE_AND_AFTER consistency, it is not allowed.
SET @@SESSION.group_replication_consistency= 'BEFORE_AND_AFTER';
--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT
INSERT INTO t1 VALUES (3);
--echo
--echo ############################################################
--echo # 06. Validate data.
# Wait until server1 applier handles all transactions.
SET @@SESSION.group_replication_consistency= DEFAULT;
INSERT INTO t1 VALUES (0);
--source include/rpl_sync.inc
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $assert_text= '1 exists in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1
--source include/assert.inc
--let $assert_text= '2 does not exist in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=2, count, 1] = 0
--source include/assert.inc
--let $assert_text= '3 does not exist in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=3, count, 1] = 0
--source include/assert.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $assert_text= '1 exists in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1
--source include/assert.inc
--let $assert_text= '2 does not exist in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=2, count, 1] = 0
--source include/assert.inc
--let $assert_text= '3 does not exist in table t1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=3, count, 1] = 0
--source include/assert.inc
--echo
--echo ############################################################
--echo # 07. Clean up.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
DROP TABLE t1;
SET @@GLOBAL.DEBUG= '-d,group_replication_force_lower_version_on_group_replication_consistency';
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
SET @@GLOBAL.DEBUG= '-d,group_replication_force_lower_version_on_group_replication_consistency';
--source include/group_replication_end.inc
|