| 1 |
include/group_replication.inc [rpl_server_count=3] |
| 2 |
Warnings: |
| 3 |
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 |
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. |
| 5 |
[connection server1] |
| 6 |
|
| 7 |
# 1. Members in Multy Primary Mode, create two tables and rpl_sync |
| 8 |
set session sql_log_bin=0; |
| 9 |
call mtr.add_suppression("Error while executing a group configuration operation: This operation was locally aborted and for that reason terminated. However the*"); |
| 10 |
set session sql_log_bin=1; |
| 11 |
CREATE TABLE test.t1 (a INT PRIMARY KEY); |
| 12 |
CREATE TABLE test.t2 (a INT PRIMARY KEY); |
| 13 |
include/rpl_sync.inc |
| 14 |
|
| 15 |
# 2. On a member server2 that will be secondary lock a table t1 |
| 16 |
[connection server2] |
| 17 |
LOCK TABLE t1 READ; |
| 18 |
|
| 19 |
# 3. On other member insert value on table locked on server2 |
| 20 |
[connection server_3] |
| 21 |
SET @@GLOBAL.group_replication_member_weight= 90; |
| 22 |
INSERT INTO t1 VALUES (1); |
| 23 |
[connection server_2] |
| 24 |
|
| 25 |
# 4. Execute action to change to single primary with server1 as primary |
| 26 |
[connection server3] |
| 27 |
SELECT group_replication_switch_to_single_primary_mode("MEMBER1_UUID"); |
| 28 |
[connection server_3] |
| 29 |
|
| 30 |
# 5. Check that the other members are waiting for members to be in read |
| 31 |
# mode. Stages should be |
| 32 |
# - Primary Election: waiting for members to enable super_read_only |
| 33 |
# - Single-primary Switch: executing Primary election - completed work 0 |
| 34 |
include/assert.inc [The stage should be "Single-primary Switch: executing Primary election"] |
| 35 |
include/assert.inc [The stage should be "Primary Election: waiting for members to enable super_read_only"] |
| 36 |
|
| 37 |
# 6. Lock a table t2 on the primary server1 |
| 38 |
[connection server1] |
| 39 |
LOCK TABLE t2 READ; |
| 40 |
|
| 41 |
# 7. Insert something on t2 on server2, the locked secondary |
| 42 |
[connection server_2_1] |
| 43 |
INSERT INTO t2 VALUES (1); |
| 44 |
|
| 45 |
# 8. Unlock table t1 on server2, the locked secondary |
| 46 |
[connection server2] |
| 47 |
UNLOCK TABLES; |
| 48 |
|
| 49 |
# 9. Stage should be |
| 50 |
# - Single-primary Switch: executing Primary election - completed work 1 |
| 51 |
|
| 52 |
# 10. Stop the new primary server1 |
| 53 |
[connection server_1] |
| 54 |
STOP GROUP_REPLICATION; |
| 55 |
[connection server2] |
| 56 |
include/rpl_gr_wait_for_number_of_members.inc |
| 57 |
[connection server1] |
| 58 |
UNLOCK TABLES; |
| 59 |
[connection server_1] |
| 60 |
include/gr_wait_for_member_state.inc |
| 61 |
include/assert_grep.inc [Found the expected error about the operation abort] |
| 62 |
include/assert.inc [group_replication_enforce_update_everywhere_checks is OFF] |
| 63 |
include/assert.inc [The primary mode should be 1 here.] |
| 64 |
|
| 65 |
# 11. Check that the action finishes |
| 66 |
[connection server2] |
| 67 |
include/rpl_gr_wait_for_number_of_members.inc |
| 68 |
|
| 69 |
# 12. Check server2 was able to insert value |
| 70 |
[connection server_2_1] |
| 71 |
|
| 72 |
# 13. Using weights one can assert here that primary is now server3 |
| 73 |
[connection server3] |
| 74 |
group_replication_switch_to_single_primary_mode("MEMBER1_UUID") |
| 75 |
Mode switched to single-primary with reported warnings: The appointed primary left the group as the operation is terminating. Check the group member list to see who is the primary. |
| 76 |
Warnings: |
| 77 |
Warning 3910 The appointed primary left the group as the operation is terminating. Check the group member list to see who is the primary. There were warnings detected also on other members, check their logs. |
| 78 |
include/gr_assert_primary_member.inc |
| 79 |
|
| 80 |
# 14. Cleanup |
| 81 |
[connection server1] |
| 82 |
include/start_group_replication.inc |
| 83 |
[connection server3] |
| 84 |
SET @@GLOBAL.group_replication_member_weight= DEFAULT; |
| 85 |
DROP TABLE t1; |
| 86 |
DROP TABLE t2; |
| 87 |
include/group_replication_end.inc |