| 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 |
CREATE TABLE test.t1 (a INT PRIMARY KEY); |
| 7 |
include/rpl_sync.inc |
| 8 |
[connection server2] |
| 9 |
|
| 10 |
# 1.1 Block the action on validation with a debug point |
| 11 |
# Change to single primary mode appoint server 2 as the new primary |
| 12 |
# Check the action is stuck in the check pre conditions stage |
| 13 |
[connection server1] |
| 14 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation'; |
| 15 |
SELECT group_replication_switch_to_single_primary_mode("MEMBER2_UUID"); |
| 16 |
[connection server_1] |
| 17 |
include/assert.inc [The stage should be "Single-primary Switch: checking group pre-conditions"] |
| 18 |
include/assert.inc [The estimated work is 1] |
| 19 |
include/assert.inc [The completed work is 0] |
| 20 |
[connection server_2] |
| 21 |
include/assert.inc [The stage should be "Single-primary Switch: checking group pre-conditions"] |
| 22 |
include/assert.inc [The estimated work is 1] |
| 23 |
include/assert.inc [The completed work is 1] |
| 24 |
|
| 25 |
# 1.2 Pause transactions on the new primary and execute a transaction on server1 |
| 26 |
# Unblock the debug point |
| 27 |
# Check the action is stuck in the Primary Election stage |
| 28 |
[connection server_2] |
| 29 |
SET @@GLOBAL.DEBUG= '+d,group_replication_wait_on_observer_trans'; |
| 30 |
[connection server_1] |
| 31 |
INSERT INTO t1 VALUES (1); |
| 32 |
SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue"; |
| 33 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation'; |
| 34 |
include/assert.inc [The stage should be "Single-primary Switch: executing Primary election"] |
| 35 |
include/assert.inc [The estimated work is 2] |
| 36 |
include/assert.inc [The completed work is 1] |
| 37 |
[connection server2] |
| 38 |
SET DEBUG_SYNC= "now WAIT_FOR signal.group_replication_wait_on_observer_trans_waiting"; |
| 39 |
include/assert.inc [The stage should be "Single-primary Switch: executing Primary election"] |
| 40 |
include/assert.inc [The estimated work is 2] |
| 41 |
include/assert.inc [The completed work is 1] |
| 42 |
|
| 43 |
# 1.3 Block the stop process of the action using a debug point |
| 44 |
# Resume transactions on the new primary |
| 45 |
# Check it is stuck in the wait for other member to finish stage |
| 46 |
[connection server_2] |
| 47 |
SET @@GLOBAL.DEBUG= '-d,group_replication_wait_on_observer_trans'; |
| 48 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop'; |
| 49 |
SET DEBUG_SYNC= 'now SIGNAL signal.group_replication_wait_on_observer_trans_continue'; |
| 50 |
include/rpl_sync.inc |
| 51 |
[connection server_1] |
| 52 |
include/assert.inc [The stage should be "Single-primary Switch: waiting for operation to complete on all members"] |
| 53 |
include/assert.inc [The estimated work is 2] |
| 54 |
include/assert.inc [The completed work is 1] |
| 55 |
[connection server2] |
| 56 |
include/assert.inc [The stage should be "Single-primary Switch: waiting for operation to complete on all members"] |
| 57 |
include/assert.inc [The estimated work is 2] |
| 58 |
include/assert.inc [The completed work is 1] |
| 59 |
SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue"; |
| 60 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop'; |
| 61 |
|
| 62 |
# 1.4 Unblock the debug point |
| 63 |
# Check the action terminates and no stages appear |
| 64 |
[connection server1] |
| 65 |
group_replication_switch_to_single_primary_mode("MEMBER2_UUID") |
| 66 |
Mode switched to single-primary successfully. |
| 67 |
include/assert.inc [There is no stage present] |
| 68 |
[connection server2] |
| 69 |
include/assert.inc [There is no stage present] |
| 70 |
|
| 71 |
# 2.1 Block the action on validation with a debug point |
| 72 |
# Change the current primary to server 1 |
| 73 |
# Check the action is stuck in the check pre conditions stage |
| 74 |
[connection server2] |
| 75 |
SET DEBUG_SYNC= 'RESET'; |
| 76 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation'; |
| 77 |
[connection server1] |
| 78 |
SET DEBUG_SYNC= 'RESET'; |
| 79 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_primary_action_validation'; |
| 80 |
SELECT group_replication_set_as_primary("MEMBER1_UUID"); |
| 81 |
[connection server_1] |
| 82 |
include/assert.inc [The stage should be "Primary switch: checking current primary pre-conditions"] |
| 83 |
include/assert.inc [The estimated work is 1] |
| 84 |
include/assert.inc [The completed work is 0] |
| 85 |
[connection server2] |
| 86 |
include/assert.inc [The stage should be "Primary switch: checking current primary pre-conditions"] |
| 87 |
include/assert.inc [The estimated work is 1] |
| 88 |
include/assert.inc [The completed work is 0] |
| 89 |
|
| 90 |
# 2.2 Start some transaction on the old primary (server2) |
| 91 |
# Unblock the debug point |
| 92 |
# Check the action is stuck waiting for old transactions to finish |
| 93 |
# Commit a transaction and see there is reported progress |
| 94 |
[connection server_1] |
| 95 |
SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue"; |
| 96 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation'; |
| 97 |
[connection server2] |
| 98 |
CREATE TABLE test.t2 (a INT PRIMARY KEY); |
| 99 |
BEGIN; |
| 100 |
INSERT INTO t1 VALUES (2); |
| 101 |
[connection server_2_1] |
| 102 |
BEGIN; |
| 103 |
INSERT INTO t2 VALUES (2); |
| 104 |
[connection server_2] |
| 105 |
SET DEBUG_SYNC= "now SIGNAL signal.primary_action_continue"; |
| 106 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_primary_action_validation'; |
| 107 |
include/assert.inc [The stage should be "Primary Switch: waiting for pending transactions to finish"] |
| 108 |
include/assert.inc [The estimated work is 2] |
| 109 |
include/assert.inc [The completed work is 0] |
| 110 |
[connection server_1] |
| 111 |
include/assert.inc [The stage should be "Primary Switch: waiting on another member step completion"] |
| 112 |
include/assert.inc [The estimated work is 1] |
| 113 |
include/assert.inc [The completed work is 0] |
| 114 |
[connection server2] |
| 115 |
COMMIT; |
| 116 |
[connection server_2] |
| 117 |
include/assert.inc [The stage should be "Primary Switch: waiting for pending transactions to finish"] |
| 118 |
include/assert.inc [The estimated work is 2] |
| 119 |
include/assert.inc [The completed work is 1] |
| 120 |
|
| 121 |
# 2.3 Lock a table t1 and execute a transaction on server2. |
| 122 |
# This will block the read mode during election |
| 123 |
# Commit the last transaction blocking phase 2.2 (table 2) |
| 124 |
# Check the action is stuck in the Primary Election stage |
| 125 |
[connection server_2] |
| 126 |
LOCK TABLE t1 WRITE; |
| 127 |
[connection slave] |
| 128 |
INSERT INTO t1 VALUES (3); |
| 129 |
[connection server_2_1] |
| 130 |
COMMIT; |
| 131 |
[connection server_1] |
| 132 |
include/assert.inc [The stage should be "Primary Switch: executing Primary election"] |
| 133 |
include/assert.inc [The estimated work is 2] |
| 134 |
include/assert.inc [The completed work is 0] |
| 135 |
[connection server2] |
| 136 |
include/assert.inc [The stage should be "Primary Switch: executing Primary election"] |
| 137 |
include/assert.inc [The estimated work is 2] |
| 138 |
include/assert.inc [The completed work is 0] |
| 139 |
|
| 140 |
# 2.4 Block the stop process of the action using a debug point |
| 141 |
# Unlock the table on the old primary (server2) |
| 142 |
# Check it is stuck in the wait for other member to finish stage |
| 143 |
[connection server_1] |
| 144 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop'; |
| 145 |
[connection server_2] |
| 146 |
UNLOCK TABLES; |
| 147 |
[connection slave] |
| 148 |
[connection server_1] |
| 149 |
include/assert.inc [The stage should be "Primary Switch: waiting for operation to complete on all members"] |
| 150 |
include/assert.inc [The estimated work is 2] |
| 151 |
include/assert.inc [The completed work is 1] |
| 152 |
[connection server2] |
| 153 |
include/assert.inc [The stage should be "Primary Switch: waiting for operation to complete on all members"] |
| 154 |
include/assert.inc [The estimated work is 2] |
| 155 |
include/assert.inc [The completed work is 1] |
| 156 |
[connection server_1] |
| 157 |
SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue"; |
| 158 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop'; |
| 159 |
|
| 160 |
# 2.5 Unblock the debug point |
| 161 |
# Check the action terminates and no stages appear |
| 162 |
[connection server1] |
| 163 |
group_replication_set_as_primary("MEMBER1_UUID") |
| 164 |
Primary server switched to: MEMBER1_UUID |
| 165 |
include/assert.inc [There is no stage present] |
| 166 |
[connection server2] |
| 167 |
include/assert.inc [There is no stage present] |
| 168 |
|
| 169 |
# 3. Clean up |
| 170 |
[connection server1] |
| 171 |
DROP TABLE t1; |
| 172 |
DROP TABLE t2; |
| 173 |
include/group_replication_end.inc |