| 1 |
include/group_replication.inc |
| 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. Setup group of 2 servers, M1(primary) and M2(secondary). |
| 8 |
[connection server1] |
| 9 |
CREATE TABLE t1(c1 int primary key); |
| 10 |
include/start_and_bootstrap_group_replication.inc |
| 11 |
[connection server2] |
| 12 |
include/start_group_replication.inc |
| 13 |
|
| 14 |
# 2. Execute a transaction on server1 and block it in committing state. |
| 15 |
[connection server1] |
| 16 |
SET @@GLOBAL.DEBUG= '+d,group_replication_before_commit_hook_wait'; |
| 17 |
INSERT INTO t1 values(1); |
| 18 |
[connection server_1] |
| 19 |
SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_before_commit_hook_wait_reached"; |
| 20 |
|
| 21 |
# 3. Execute change primary on server2 and block the operation. |
| 22 |
[connection server2] |
| 23 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation'; |
| 24 |
SELECT group_replication_set_as_primary("SERVER2_UUID", 0);; |
| 25 |
[connection server_1] |
| 26 |
|
| 27 |
# 4. Unblock transaction running on sever1 and reap result. |
| 28 |
# Unblock change primary operation and reap result. |
| 29 |
[connection server_1] |
| 30 |
SET DEBUG_SYNC= "now SIGNAL continue_commit"; |
| 31 |
SET @@GLOBAL.DEBUG= '-d,group_replication_before_commit_hook_wait'; |
| 32 |
[connection server1] |
| 33 |
[connection server_2] |
| 34 |
SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue"; |
| 35 |
[connection server2] |
| 36 |
group_replication_set_as_primary("SERVER2_UUID", 0) |
| 37 |
Primary server switched to: SERVER2_UUID |
| 38 |
|
| 39 |
# 5. Assert primary and secondary status are correct. |
| 40 |
# Assert data is present on both members. |
| 41 |
[connection server2] |
| 42 |
include/gr_assert_primary_member.inc |
| 43 |
[connection server1] |
| 44 |
include/gr_assert_secondary_member.inc |
| 45 |
include/assert.inc ['There is a value 1 in table t1'] |
| 46 |
include/diff_tables.inc [server1:test.t1, server2:test.t1] |
| 47 |
|
| 48 |
# 6. Execute a transaction on server2 and block it in committing state. |
| 49 |
[connection server2] |
| 50 |
SET @@GLOBAL.DEBUG= '+d,group_replication_before_commit_hook_wait'; |
| 51 |
INSERT INTO t1 values(2); |
| 52 |
[connection server_2] |
| 53 |
SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_before_commit_hook_wait_reached"; |
| 54 |
|
| 55 |
# 7. Execute change primary on server2 and block the operation. |
| 56 |
[connection server_2] |
| 57 |
SELECT group_replication_set_as_primary("SERVER1_UUID", 0);; |
| 58 |
[connection server_2_1] |
| 59 |
|
| 60 |
# 8. Unblock transaction running on sever2 and reap result. |
| 61 |
# Unblock change primary operation and reap result. |
| 62 |
[connection server_2_1] |
| 63 |
SET DEBUG_SYNC= "now SIGNAL continue_commit"; |
| 64 |
SET @@GLOBAL.DEBUG= '-d,group_replication_before_commit_hook_wait'; |
| 65 |
[connection server2] |
| 66 |
SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue"; |
| 67 |
[connection server_2] |
| 68 |
group_replication_set_as_primary("SERVER1_UUID", 0) |
| 69 |
Primary server switched to: SERVER1_UUID |
| 70 |
|
| 71 |
# 9. Assert primary and secondary status are correct. |
| 72 |
# Assert data is present on both members. |
| 73 |
[connection server1] |
| 74 |
include/gr_assert_primary_member.inc |
| 75 |
[connection server2] |
| 76 |
include/gr_assert_secondary_member.inc |
| 77 |
include/assert.inc ['There is a value 2 in table t1'] |
| 78 |
include/diff_tables.inc [server1:test.t1, server2:test.t1] |
| 79 |
|
| 80 |
# 10. Cleanup. |
| 81 |
[connection server1] |
| 82 |
DROP TABLE t1; |
| 83 |
include/rpl_sync.inc |
| 84 |
[connection server2] |
| 85 |
SET DEBUG_SYNC= 'RESET'; |
| 86 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation'; |
| 87 |
include/group_replication_end.inc |