| 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 |
SET SESSION sql_log_bin=0; |
| 7 |
call mtr.add_suppression("Member was expelled from the group due to network failures, changing member status to ERROR."); |
| 8 |
call mtr.add_suppression("The server was automatically set into read only mode after an error was detected."); |
| 9 |
call mtr.add_suppression("The function 'group_replication_switch_to_single_primary_mode' failed. Member has left the group. This operation was locally aborted and for that reason terminated."); |
| 10 |
call mtr.add_suppression("read failed"); |
| 11 |
call mtr.add_suppression("\\[GCS\\] Unable to resolve peer address."); |
| 12 |
SET SESSION sql_log_bin=1; |
| 13 |
|
| 14 |
# 1. Save pid from server1 to be able to freeze it |
| 15 |
SET SESSION sql_log_bin = 0; |
| 16 |
CREATE TABLE pid_table(pid_no INT PRIMARY KEY); |
| 17 |
LOAD DATA LOCAL INFILE 'pid_file' INTO TABLE pid_table; |
| 18 |
DROP TABLE pid_table; |
| 19 |
SET SESSION sql_log_bin = 1; |
| 20 |
|
| 21 |
# 2. Create table t1 |
| 22 |
CREATE TABLE test.t1 (a INT PRIMARY KEY); |
| 23 |
include/rpl_sync.inc |
| 24 |
|
| 25 |
# 3. Lock table t1 on server2 to block action |
| 26 |
[connection server2] |
| 27 |
LOCK TABLE t1 READ; |
| 28 |
[connection server3] |
| 29 |
|
| 30 |
# 4. Server1 insert value on t1 |
| 31 |
[connection server1] |
| 32 |
INSERT INTO t1 VALUES (1); |
| 33 |
|
| 34 |
# 5. Execute action switch to single primary mode |
| 35 |
SELECT group_replication_switch_to_single_primary_mode("MEMBER1_UUID"); |
| 36 |
|
| 37 |
# 6. Freeze server1 sending a SIGSTOP signal |
| 38 |
[connection server_1] |
| 39 |
|
| 40 |
# 7. Wait server1 is expelled from group |
| 41 |
[connection server2] |
| 42 |
include/rpl_gr_wait_for_number_of_members.inc |
| 43 |
|
| 44 |
# 8. Unlock table to action continue |
| 45 |
UNLOCK TABLES; |
| 46 |
|
| 47 |
# 9. Send signal to server continue its process |
| 48 |
[connection server_1] |
| 49 |
|
| 50 |
# 10. The action is aborted on server1 |
| 51 |
[connection server1] |
| 52 |
ERROR HY000: The function 'group_replication_switch_to_single_primary_mode' failed. Member has left the group. This operation was locally aborted and for that reason terminated. |
| 53 |
|
| 54 |
# 11. Wait that server2 terminate execution of primary election |
| 55 |
[connection server2] |
| 56 |
[connection server3] |
| 57 |
|
| 58 |
# 12. Assert primary and secondary role of members |
| 59 |
include/gr_assert_secondary_member.inc |
| 60 |
include/gr_assert_primary_member.inc |
| 61 |
|
| 62 |
# 13. Cleanup |
| 63 |
[connection server1] |
| 64 |
include/stop_group_replication.inc |
| 65 |
SET GLOBAL group_replication_enforce_update_everywhere_checks= FALSE; |
| 66 |
SET GLOBAL group_replication_single_primary_mode= TRUE; |
| 67 |
include/start_group_replication.inc |
| 68 |
DROP TABLE t1; |
| 69 |
include/group_replication_end.inc |