| 1 |
################################################################################ |
| 2 |
# Validate that BEFORE can be used when there are lower version members on the |
| 3 |
# group. |
| 4 |
# Validate that AFTER and BEFORE_AND_AFTER can not be used when there are lower |
| 5 |
# version members on the group. |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 00. The test requires two servers: M1 and M2. |
| 9 |
# 01. Create one table on the group. |
| 10 |
# 02. Force that there is a lower version member. |
| 11 |
# 03. Test BEFORE consistency, it is allowed. |
| 12 |
# 04. Test AFTER consistency, it is not allowed. |
| 13 |
# 05. Test BEFORE_AND_AFTER consistency, it is not allowed. |
| 14 |
# 06. Validate data. |
| 15 |
# 07. Clean up. |
| 16 |
################################################################################ |
| 17 |
--source include/have_debug.inc |
| 18 |
--source include/have_group_replication_plugin.inc |
| 19 |
--source include/group_replication.inc |
| 20 |
|
| 21 |
--echo |
| 22 |
--echo ############################################################ |
| 23 |
--echo # 01. Create one table on the group. |
| 24 |
--let $rpl_connection_name= server1 |
| 25 |
--source include/rpl_connection.inc |
| 26 |
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY); |
| 27 |
--source include/rpl_sync.inc |
| 28 |
|
| 29 |
|
| 30 |
--echo |
| 31 |
--echo ############################################################ |
| 32 |
--echo # 02. Force that there is a lower version member. |
| 33 |
--let $rpl_connection_name= server1 |
| 34 |
--source include/rpl_connection.inc |
| 35 |
SET @@GLOBAL.DEBUG= '+d,group_replication_force_lower_version_on_group_replication_consistency'; |
| 36 |
|
| 37 |
--let $rpl_connection_name= server2 |
| 38 |
--source include/rpl_connection.inc |
| 39 |
SET @@GLOBAL.DEBUG= '+d,group_replication_force_lower_version_on_group_replication_consistency'; |
| 40 |
|
| 41 |
|
| 42 |
--echo |
| 43 |
--echo ############################################################ |
| 44 |
--echo # 03. Test BEFORE consistency, it is allowed. |
| 45 |
SET @@SESSION.group_replication_consistency= 'BEFORE'; |
| 46 |
INSERT INTO t1 VALUES (1); |
| 47 |
|
| 48 |
|
| 49 |
--echo |
| 50 |
--echo ############################################################ |
| 51 |
--echo # 04. Test AFTER consistency, it is not allowed. |
| 52 |
SET @@SESSION.group_replication_consistency= 'AFTER'; |
| 53 |
--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT |
| 54 |
INSERT INTO t1 VALUES (2); |
| 55 |
|
| 56 |
|
| 57 |
--echo |
| 58 |
--echo ############################################################ |
| 59 |
--echo # 05. Test BEFORE_AND_AFTER consistency, it is not allowed. |
| 60 |
SET @@SESSION.group_replication_consistency= 'BEFORE_AND_AFTER'; |
| 61 |
--error ER_TRANSACTION_ROLLBACK_DURING_COMMIT |
| 62 |
INSERT INTO t1 VALUES (3); |
| 63 |
|
| 64 |
|
| 65 |
--echo |
| 66 |
--echo ############################################################ |
| 67 |
--echo # 06. Validate data. |
| 68 |
# Wait until server1 applier handles all transactions. |
| 69 |
SET @@SESSION.group_replication_consistency= DEFAULT; |
| 70 |
INSERT INTO t1 VALUES (0); |
| 71 |
--source include/rpl_sync.inc |
| 72 |
|
| 73 |
--let $rpl_connection_name= server1 |
| 74 |
--source include/rpl_connection.inc |
| 75 |
|
| 76 |
--let $assert_text= '1 exists in table t1' |
| 77 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1 |
| 78 |
--source include/assert.inc |
| 79 |
|
| 80 |
--let $assert_text= '2 does not exist in table t1' |
| 81 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=2, count, 1] = 0 |
| 82 |
--source include/assert.inc |
| 83 |
|
| 84 |
--let $assert_text= '3 does not exist in table t1' |
| 85 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=3, count, 1] = 0 |
| 86 |
--source include/assert.inc |
| 87 |
|
| 88 |
--let $rpl_connection_name= server2 |
| 89 |
--source include/rpl_connection.inc |
| 90 |
|
| 91 |
--let $assert_text= '1 exists in table t1' |
| 92 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=1, count, 1] = 1 |
| 93 |
--source include/assert.inc |
| 94 |
|
| 95 |
--let $assert_text= '2 does not exist in table t1' |
| 96 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=2, count, 1] = 0 |
| 97 |
--source include/assert.inc |
| 98 |
|
| 99 |
--let $assert_text= '3 does not exist in table t1' |
| 100 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE c1=3, count, 1] = 0 |
| 101 |
--source include/assert.inc |
| 102 |
|
| 103 |
|
| 104 |
--echo |
| 105 |
--echo ############################################################ |
| 106 |
--echo # 07. Clean up. |
| 107 |
--let $rpl_connection_name= server1 |
| 108 |
--source include/rpl_connection.inc |
| 109 |
DROP TABLE t1; |
| 110 |
SET @@GLOBAL.DEBUG= '-d,group_replication_force_lower_version_on_group_replication_consistency'; |
| 111 |
|
| 112 |
--let $rpl_connection_name= server2 |
| 113 |
--source include/rpl_connection.inc |
| 114 |
SET @@GLOBAL.DEBUG= '-d,group_replication_force_lower_version_on_group_replication_consistency'; |
| 115 |
|
| 116 |
--source include/group_replication_end.inc |