| 1 |
################################################################################ |
| 2 |
# This test verifies that during in GR the set super_read_only is blocked |
| 3 |
# due to a table being locked. Subsequently, an unlock of the table in another |
| 4 |
# connection will unblock the setting of super_read_only mode and the recovery |
| 5 |
# proceeds further. |
| 6 |
# |
| 7 |
# Test: |
| 8 |
# 0. The test requires two servers: M1 and M2. |
| 9 |
# 1. With both members ONLINE. Group replication is then blocked on one of |
| 10 |
# the node M1. |
| 11 |
# 2. Add some data on the remaining member of the GROUP. |
| 12 |
# 3. On the member which is not a member of the GROUP lock the table and start |
| 13 |
# GR so that it enters the recovering stage. This should be blocked as the |
| 14 |
# set super_read_only cannot execute further. |
| 15 |
# 4. In another connection unlock the tables and see that the recovery proceeds |
| 16 |
# and the data exists on the two members. |
| 17 |
# 5. Clean up. |
| 18 |
################################################################################ |
| 19 |
|
| 20 |
--source include/big_test.inc |
| 21 |
--source include/not_windows.inc |
| 22 |
--source include/have_group_replication_plugin.inc |
| 23 |
--source include/group_replication.inc |
| 24 |
|
| 25 |
--connection server2 |
| 26 |
CREATE TABLE t1 (i INT PRIMARY KEY); |
| 27 |
--source include/rpl_sync.inc |
| 28 |
|
| 29 |
--connection server1 |
| 30 |
--source include/stop_group_replication.inc |
| 31 |
|
| 32 |
--connection server2 |
| 33 |
INSERT INTO t1 VALUES(1); |
| 34 |
|
| 35 |
--echo # Add lock tables here to block setting super_read_only mode on server. |
| 36 |
--connection server_1 |
| 37 |
LOCK TABLE t1 WRITE; |
| 38 |
|
| 39 |
--echo # Start GR on the server. It should be blocked as we have a table locked. |
| 40 |
--connection server1 |
| 41 |
--disable_query_log |
| 42 |
--eval SET GLOBAL group_replication_group_name= "$group_replication_group_name" |
| 43 |
--enable_query_log |
| 44 |
--send START GROUP_REPLICATION |
| 45 |
|
| 46 |
--echo # Ensure that the server is actually blocked while setting the |
| 47 |
--echo # super_read_only mode. |
| 48 |
--let $rpl_connection_name= server_1_1 |
| 49 |
--source include/rpl_connection.inc |
| 50 |
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.threads WHERE NAME = 'thread/group_rpl/THD_mysql_thread_handler_read_only_mode' AND PROCESSLIST_STATE = 'Waiting for global read lock' |
| 51 |
--source include/wait_condition.inc |
| 52 |
|
| 53 |
--connection server_1 |
| 54 |
UNLOCK TABLES; |
| 55 |
|
| 56 |
--connection server1 |
| 57 |
--reap |
| 58 |
|
| 59 |
--let $group_replication_member_state= ONLINE |
| 60 |
--source include/gr_wait_for_member_state.inc |
| 61 |
|
| 62 |
--echo # Add ASSERT to check that the recovery passes successfully and a row |
| 63 |
--echo # is inserted. |
| 64 |
--let $assert_text= There should be one row inserted in the table. |
| 65 |
--let $assert_cond= [SELECT COUNT(*) FROM t1] = 1 |
| 66 |
--source include/assert.inc |
| 67 |
|
| 68 |
--echo # Cleanup |
| 69 |
DROP TABLE t1; |
| 70 |
|
| 71 |
--source include/group_replication_end.inc |