| 1 |
################################################################################ |
| 2 |
# Validate the correct behaviour when a member joins a group in single-primary |
| 3 |
# mode while there is a transaction with group_replication_consistency= 'AFTER' |
| 4 |
# ongoing. |
| 5 |
# |
| 6 |
# Test: |
| 7 |
# 00. The test requires three servers: M1, M2 and M3. |
| 8 |
# 01. Bootstrap group with M1, add M2. |
| 9 |
# 02. Lock table t1 on server2 to block a future update. |
| 10 |
# 03. Execute transaction T1, the transaction will block since |
| 11 |
# server2 cannot prepare. |
| 12 |
# 04. Execute START GR on M3. |
| 13 |
# The member will be in RECOVERING until T1 is complete. |
| 14 |
# 05. On M2: Unlock t1. |
| 15 |
# 06. server3 will change to ONLINE state. |
| 16 |
# 07. Validate data. |
| 17 |
# 08. Clean up. |
| 18 |
################################################################################ |
| 19 |
--source include/big_test.inc |
| 20 |
--source include/have_group_replication_plugin.inc |
| 21 |
--let $rpl_skip_group_replication_start= 1 |
| 22 |
--let $rpl_server_count= 3 |
| 23 |
--let $rpl_group_replication_single_primary_mode=1 |
| 24 |
--source include/group_replication.inc |
| 25 |
|
| 26 |
--echo |
| 27 |
--echo ############################################################ |
| 28 |
--echo # 01. Bootstrap group with M1, add M2. |
| 29 |
--let $rpl_connection_name= server1 |
| 30 |
--source include/rpl_connection.inc |
| 31 |
--source include/start_and_bootstrap_group_replication.inc |
| 32 |
CREATE TABLE t1 (a INT PRIMARY KEY); |
| 33 |
INSERT INTO t1 VALUES (1); |
| 34 |
|
| 35 |
--let $rpl_connection_name= server2 |
| 36 |
--source include/rpl_connection.inc |
| 37 |
--source include/start_group_replication.inc |
| 38 |
|
| 39 |
|
| 40 |
--echo |
| 41 |
--echo ############################################################ |
| 42 |
--echo # 02. Lock table t1 on server2 to block a future update. |
| 43 |
--let $rpl_connection_name= server2 |
| 44 |
--source include/rpl_connection.inc |
| 45 |
LOCK TABLE t1 READ; |
| 46 |
|
| 47 |
|
| 48 |
--echo |
| 49 |
--echo ############################################################ |
| 50 |
--echo # 03. Execute transaction T1, the transaction will block since |
| 51 |
--echo # server2 cannot prepare. |
| 52 |
--let $rpl_connection_name= server1 |
| 53 |
--source include/rpl_connection.inc |
| 54 |
--send INSERT INTO t1 VALUES (2) |
| 55 |
|
| 56 |
|
| 57 |
--echo ############################################################ |
| 58 |
--echo # 04. Execute START GR on M3. |
| 59 |
--echo # The member will be in RECOVERING until T1 is complete. |
| 60 |
--let $rpl_connection_name= server3 |
| 61 |
--source include/rpl_connection.inc |
| 62 |
--let $group_replication_start_member_state= RECOVERING |
| 63 |
--source include/start_group_replication.inc |
| 64 |
# Give some time to the view clash with T1 on member1 |
| 65 |
--sleep 40 |
| 66 |
|
| 67 |
|
| 68 |
--echo |
| 69 |
--echo ############################################################ |
| 70 |
--echo # 05. On M2: Unlock t1. |
| 71 |
--let $rpl_connection_name= server2 |
| 72 |
--source include/rpl_connection.inc |
| 73 |
UNLOCK TABLES; |
| 74 |
|
| 75 |
|
| 76 |
--echo |
| 77 |
--echo ############################################################ |
| 78 |
--echo # 06. server3 will change to ONLINE state. |
| 79 |
--let $rpl_connection_name= server3 |
| 80 |
--source include/rpl_connection.inc |
| 81 |
--let $group_replication_member_state= ONLINE |
| 82 |
--source include/gr_wait_for_member_state.inc |
| 83 |
|
| 84 |
|
| 85 |
--echo |
| 86 |
--echo ############################################################ |
| 87 |
--echo # 07. Validate data. |
| 88 |
--let $rpl_connection_name= server1 |
| 89 |
--source include/rpl_connection.inc |
| 90 |
--reap |
| 91 |
--let $assert_text= 'There is a 1 value in table t1' |
| 92 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=1, count, 1] = 1 |
| 93 |
--source include/assert.inc |
| 94 |
--let $assert_text= 'There is a 2 value in table t1' |
| 95 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=2, count, 1] = 1 |
| 96 |
--source include/assert.inc |
| 97 |
|
| 98 |
--let $keep_gtid_events= 1 |
| 99 |
--source include/show_binlog_events.inc |
| 100 |
|
| 101 |
--let $rpl_connection_name= server2 |
| 102 |
--source include/rpl_connection.inc |
| 103 |
--let $assert_text= 'There is a 1 value in table t1' |
| 104 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=1, count, 1] = 1 |
| 105 |
--source include/assert.inc |
| 106 |
--let $assert_text= 'There is a 2 value in table t1' |
| 107 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=2, count, 1] = 1 |
| 108 |
--source include/assert.inc |
| 109 |
|
| 110 |
--let $keep_gtid_events= 1 |
| 111 |
--source include/show_binlog_events.inc |
| 112 |
|
| 113 |
--let $rpl_connection_name= server3 |
| 114 |
--source include/rpl_connection.inc |
| 115 |
--let $assert_text= 'There is a 1 value in table t1' |
| 116 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=1, count, 1] = 1 |
| 117 |
--source include/assert.inc |
| 118 |
--let $assert_text= 'There is a 2 value in table t1' |
| 119 |
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE a=2, count, 1] = 1 |
| 120 |
--source include/assert.inc |
| 121 |
|
| 122 |
--let $keep_gtid_events= 1 |
| 123 |
--source include/show_binlog_events.inc |
| 124 |
|
| 125 |
--let $diff_tables=server1:t1, server2:t1, server3:t1 |
| 126 |
--source include/diff_tables.inc |
| 127 |
|
| 128 |
|
| 129 |
--echo |
| 130 |
--echo ############################################################ |
| 131 |
--echo # 08. Clean up. |
| 132 |
--let $rpl_connection_name= server1 |
| 133 |
--source include/rpl_connection.inc |
| 134 |
|
| 135 |
DROP TABLE t1; |
| 136 |
|
| 137 |
--source include/group_replication_end.inc |