| 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 |
include/start_and_bootstrap_group_replication.inc |
| 10 |
CREATE TABLE t1(c1 int primary key); |
| 11 |
[connection server2] |
| 12 |
include/start_group_replication.inc |
| 13 |
|
| 14 |
# 2. Block all commits on server1 and initiate a transaction. |
| 15 |
# Begin change of primary from server2(secondary). |
| 16 |
[connection server1] |
| 17 |
SET @@GLOBAL.DEBUG= '+d,trans_delegate_before_commit_before_before_call_observers'; |
| 18 |
INSERT INTO t1 values(1); |
| 19 |
[connection server_1] |
| 20 |
SET DEBUG_SYNC= "now WAIT_FOR signal.trans_delegate_before_commit_before_before_call_observers_reached"; |
| 21 |
SET @@GLOBAL.DEBUG= '-d,trans_delegate_before_commit_before_before_call_observers'; |
| 22 |
[connection server2] |
| 23 |
SELECT group_replication_set_as_primary("SERVER2_UUID", 0);; |
| 24 |
group_replication_set_as_primary("SERVER2_UUID", 0) |
| 25 |
Primary server switched to: SERVER2_UUID |
| 26 |
|
| 27 |
# 3. Unblock transactions on server1. |
| 28 |
# Transaction should fail it was not committing so it was killed |
| 29 |
# and client connection dropped. |
| 30 |
[connection server_1] |
| 31 |
SET DEBUG_SYNC= "now SIGNAL signal.trans_delegate_before_commit_before_before_call_observers_waiting"; |
| 32 |
[connection server1] |
| 33 |
ERROR HY000: Lost connection to MySQL server during query |
| 34 |
SET DEBUG_SYNC= 'RESET'; |
| 35 |
|
| 36 |
# 4. Assert primary changed. |
| 37 |
# Assert data is not present on M1 and M2. |
| 38 |
[connection server2] |
| 39 |
include/gr_assert_primary_member.inc |
| 40 |
[connection server1] |
| 41 |
include/gr_assert_secondary_member.inc |
| 42 |
include/assert.inc ['There is no value 1 in table t1.'] |
| 43 |
include/diff_tables.inc [server1:test.t1, server2:test.t1] |
| 44 |
|
| 45 |
# 5. Block all commits on server2 and initiate a transaction. |
| 46 |
# Begin change of primary from server2(primary). |
| 47 |
[connection server2] |
| 48 |
SET @@GLOBAL.DEBUG= '+d,trans_delegate_before_commit_before_before_call_observers'; |
| 49 |
INSERT INTO t1 values(1); |
| 50 |
[connection server_2] |
| 51 |
SET DEBUG_SYNC= "now WAIT_FOR signal.trans_delegate_before_commit_before_before_call_observers_reached"; |
| 52 |
SET @@GLOBAL.DEBUG= '-d,trans_delegate_before_commit_before_before_call_observers'; |
| 53 |
SELECT group_replication_set_as_primary("SERVER1_UUID", 2);; |
| 54 |
group_replication_set_as_primary("SERVER1_UUID", 2) |
| 55 |
Primary server switched to: SERVER1_UUID |
| 56 |
|
| 57 |
# 6. Unblock transactions on server2. |
| 58 |
# Transaction should fail it was not committing so it was killed |
| 59 |
# and client connection dropped. |
| 60 |
SET DEBUG_SYNC= "now SIGNAL signal.trans_delegate_before_commit_before_before_call_observers_waiting"; |
| 61 |
[connection server2] |
| 62 |
ERROR HY000: Lost connection to MySQL server during query |
| 63 |
SET DEBUG_SYNC= 'RESET'; |
| 64 |
|
| 65 |
# 7. Assert primary changed. |
| 66 |
# Assert data is not present on M1 and M2. |
| 67 |
[connection server1] |
| 68 |
include/gr_assert_primary_member.inc |
| 69 |
[connection server2] |
| 70 |
include/gr_assert_secondary_member.inc |
| 71 |
include/assert.inc ['There is no value 1 in table t1.'] |
| 72 |
include/diff_tables.inc [server1:test.t1, server2:test.t1] |
| 73 |
|
| 74 |
# 8. Cleanup. |
| 75 |
[connection server1] |
| 76 |
DROP TABLE t1; |
| 77 |
include/rpl_sync.inc |
| 78 |
include/group_replication_end.inc |