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
|
###############################################################################
#
# When a member is executing an action it cannot change its weight,
# it shall fail
#
# Test:
# 0. This test requires three servers
# 1. Create a table on group
# 2. Lock tables on server2, this will block the action after insert
# data on the group
# 3. Insert values and execute action
# 4. Confirm group is waiting for members to set read only
# 5. Confirm server1 that is executing action, can't change value of
# member weight
# 6. Confirm server2 can't change value of member weight, an action is
# being executed on the group
# 7. Unlock the tables and to allow action proceed
# 8. Reap action that will complete successfully
# 9. Cleanup
#
###############################################################################
--source include/big_test.inc
--source include/have_group_replication_plugin.inc
--source include/group_replication.inc
--echo
--echo # 1. Create a table on group
CREATE TABLE test.t1 (a INT PRIMARY KEY);
--source include/rpl_sync.inc
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--echo
--echo # 2. Lock tables on server2, this will block the action after insert
--echo # data on the group
LOCK TABLE t1 WRITE;
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--echo
--echo # 3. Insert values and execute action
--let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
INSERT INTO t1 VALUES (1);
--replace_result $server1_uuid MEMBER1_UUID
--send_eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid")
--echo
--echo # 4. Confirm group is waiting for members to set read only
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=1 FROM performance_schema.events_stages_current WHERE event_name LIKE "%stage/group_rpl/Primary Election: waiting for members to enable super_read_only%"
--source include/wait_condition.inc
--echo
--echo # 5. Confirm server1 that is executing action, can't change value of
--echo # member weight
--let $rpl_connection_name= server_1
--source include/rpl_connection.inc
--error ER_WRONG_VALUE_FOR_VAR
SET @@GLOBAL.group_replication_member_weight= 100;
--echo
--echo # 6. Confirm server2 can't change value of member weight, an action is
--echo # being executed on the group
--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--error ER_WRONG_VALUE_FOR_VAR
SET @@GLOBAL.group_replication_member_weight= 100;
--echo
--echo # 7. Unlock the tables and to allow action proceed
UNLOCK TABLES;
--echo
--echo # 8. Reap action that will complete successfully
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--replace_result $server1_uuid MEMBER1_UUID
--reap
--echo
--echo # 9. Cleanup
DROP TABLE t1;
--let $rpl_group_replication_single_primary_mode=1
--let $rpl_group_replication_reset_persistent_vars=1
--source include/group_replication_end.inc
|