Debian Codegraph @

mysql-test/suite/group_replication/t/gr_primary_mode_group_operations_47.test

raw
1 ###############################################################################
2 #
3 # When a member is executing an action it cannot change its weight,
4 # it shall fail
5 #
6 # Test:
7 # 0. This test requires three servers
8 # 1. Create a table on group
9 # 2. Lock tables on server2, this will block the action after insert
10 # data on the group
11 # 3. Insert values and execute action
12 # 4. Confirm group is waiting for members to set read only
13 # 5. Confirm server1 that is executing action, can't change value of
14 # member weight
15 # 6. Confirm server2 can't change value of member weight, an action is
16 # being executed on the group
17 # 7. Unlock the tables and to allow action proceed
18 # 8. Reap action that will complete successfully
19 # 9. Cleanup
20 #
21 ###############################################################################
22
23 --source include/big_test.inc
24 --source include/have_group_replication_plugin.inc
25 --source include/group_replication.inc
26
27 --echo
28 --echo # 1. Create a table on group
29
30 CREATE TABLE test.t1 (a INT PRIMARY KEY);
31
32 --source include/rpl_sync.inc
33
34 --let $rpl_connection_name= server2
35 --source include/rpl_connection.inc
36
37 --echo
38 --echo # 2. Lock tables on server2, this will block the action after insert
39 --echo # data on the group
40
41 LOCK TABLE t1 WRITE;
42
43 --let $rpl_connection_name= server1
44 --source include/rpl_connection.inc
45
46 --echo
47 --echo # 3. Insert values and execute action
48
49 --let $server1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
50
51 INSERT INTO t1 VALUES (1);
52
53 --replace_result $server1_uuid MEMBER1_UUID
54 --send_eval SELECT group_replication_switch_to_single_primary_mode("$server1_uuid")
55
56 --echo
57 --echo # 4. Confirm group is waiting for members to set read only
58
59 --let $rpl_connection_name= server_1
60 --source include/rpl_connection.inc
61
62 --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%"
63 --source include/wait_condition.inc
64
65 --echo
66 --echo # 5. Confirm server1 that is executing action, can't change value of
67 --echo # member weight
68
69 --let $rpl_connection_name= server_1
70 --source include/rpl_connection.inc
71
72 --error ER_WRONG_VALUE_FOR_VAR
73 SET @@GLOBAL.group_replication_member_weight= 100;
74
75 --echo
76 --echo # 6. Confirm server2 can't change value of member weight, an action is
77 --echo # being executed on the group
78
79 --let $rpl_connection_name= server2
80 --source include/rpl_connection.inc
81
82 --error ER_WRONG_VALUE_FOR_VAR
83 SET @@GLOBAL.group_replication_member_weight= 100;
84
85 --echo
86 --echo # 7. Unlock the tables and to allow action proceed
87
88 UNLOCK TABLES;
89
90 --echo
91 --echo # 8. Reap action that will complete successfully
92
93 --let $rpl_connection_name= server1
94 --source include/rpl_connection.inc
95
96 --replace_result $server1_uuid MEMBER1_UUID
97 --reap
98
99 --echo
100 --echo # 9. Cleanup
101
102 DROP TABLE t1;
103
104 --let $rpl_group_replication_single_primary_mode=1
105 --let $rpl_group_replication_reset_persistent_vars=1
106 --source include/group_replication_end.inc