| 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. Create table for tests on a multi primary group |
| 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."); |
| 10 |
set session sql_log_bin=1; |
| 11 |
CREATE TABLE test.t1 (a INT PRIMARY KEY); |
| 12 |
include/rpl_sync.inc |
| 13 |
[connection server3] |
| 14 |
set session sql_log_bin=0; |
| 15 |
call mtr.add_suppression("Error while executing a group configuration operation: This operation was locally aborted and for that reason terminated."); |
| 16 |
set session sql_log_bin=1; |
| 17 |
|
| 18 |
# 2. Lock table on a server that will be a secondary and set its |
| 19 |
# weight to be chosen as primary on single primary mode |
| 20 |
[connection server2] |
| 21 |
set session sql_log_bin=0; |
| 22 |
call mtr.add_suppression("Error while executing a group configuration operation: The appointed primary for election left the group, this operation will be aborted.*"); |
| 23 |
set session sql_log_bin=1; |
| 24 |
SET @@GLOBAL.group_replication_member_weight= 90; |
| 25 |
LOCK TABLE t1 READ; |
| 26 |
|
| 27 |
# 3. Insert a row on a group |
| 28 |
[connection server1] |
| 29 |
INSERT INTO t1 VALUES (1); |
| 30 |
|
| 31 |
# 4. Invoke a change to single primary selecting server3 as new primary |
| 32 |
SELECT group_replication_switch_to_single_primary_mode("MEMBER3_UUID"); |
| 33 |
|
| 34 |
# 5. Check that the other members are waiting to enable |
| 35 |
# super_read_only and executing primary election |
| 36 |
[connection server2] |
| 37 |
include/assert.inc [The stage should be "Single-primary Switch: executing Primary election"] |
| 38 |
include/assert.inc [The stage should be "stage/sql/Waiting for global read lock"] |
| 39 |
[connection server_1] |
| 40 |
include/assert.inc [The stage should be "Single-primary Switch: executing Primary election"] |
| 41 |
include/assert.inc [The stage should be "Primary Election: waiting for members to enable super_read_only"] |
| 42 |
|
| 43 |
# 6. Stop server 3 |
| 44 |
[connection server3] |
| 45 |
include/stop_group_replication.inc |
| 46 |
include/assert_grep.inc [Found the expected error about the operation abort] |
| 47 |
include/assert.inc [group_replication_enforce_update_everywhere_checks is ON] |
| 48 |
include/assert.inc [The single primary mode should be 0 here.] |
| 49 |
|
| 50 |
# 7. Wait group detect exit of server3 |
| 51 |
[connection server2] |
| 52 |
include/rpl_gr_wait_for_number_of_members.inc |
| 53 |
|
| 54 |
# 8. Unblock table on member that is blocked |
| 55 |
UNLOCK TABLES; |
| 56 |
|
| 57 |
# 9. Check that the action finishes |
| 58 |
[connection server1] |
| 59 |
group_replication_switch_to_single_primary_mode("MEMBER3_UUID") |
| 60 |
Mode switched to single-primary with reported warnings: The appointed primary being elected exited the group. Check the group member list to see who is the primary. |
| 61 |
Warnings: |
| 62 |
Warning 3910 The appointed primary being elected exited the group. Check the group member list to see who is the primary. There were warnings detected also on other members, check their logs. |
| 63 |
|
| 64 |
# 10. Confirm server2 is the new primary due its weight on member |
| 65 |
# election |
| 66 |
[connection server2] |
| 67 |
include/gr_assert_primary_member.inc |
| 68 |
# 11. Check that Single primary mode is false on the stuck member and the |
| 69 |
# update everywhere checks are true |
| 70 |
[connection server3] |
| 71 |
include/assert.inc [group_replication_enforce_update_everywhere_checks is ON] |
| 72 |
|
| 73 |
# 12. Clean up |
| 74 |
SET GLOBAL group_replication_enforce_update_everywhere_checks= FALSE; |
| 75 |
SET GLOBAL group_replication_single_primary_mode= TRUE; |
| 76 |
include/start_group_replication.inc |
| 77 |
[connection server2] |
| 78 |
SET @@GLOBAL.group_replication_member_weight= DEFAULT; |
| 79 |
DROP TABLE t1; |
| 80 |
include/group_replication_end.inc |