| 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 |
# 0. Test starts in Single primary mode with server1 as the primary |
| 8 |
include/start_and_bootstrap_group_replication.inc |
| 9 |
include/gr_assert_primary_member.inc |
| 10 |
CREATE TABLE t1(a int primary key); |
| 11 |
[connection server2] |
| 12 |
include/start_group_replication.inc |
| 13 |
|
| 14 |
# 1. Start 2 transactions on server 1 |
| 15 |
# Change to multi primary mode |
| 16 |
# On the primary the stage reports waiting for pending transactions to finish |
| 17 |
# Commit a transaction and see there is reported progress |
| 18 |
# On the secondaries the stage reports waiting for a step completion |
| 19 |
[connection server_1_1] |
| 20 |
SET @@GLOBAL.DEBUG='+d,group_replication_before_message_broadcast'; |
| 21 |
BEGIN; |
| 22 |
INSERT INTO t1 VALUES (1); |
| 23 |
COMMIT; |
| 24 |
[connection server_1] |
| 25 |
BEGIN; |
| 26 |
INSERT INTO t1 VALUES (2); |
| 27 |
[connection server2] |
| 28 |
SELECT group_replication_switch_to_multi_primary_mode(); |
| 29 |
[connection server1] |
| 30 |
include/assert.inc [The stage should be "Multi-primary Switch: waiting for pending transactions to finish"] |
| 31 |
include/assert.inc [The estimated work is 2] |
| 32 |
include/assert.inc [The completed work is 0] |
| 33 |
[connection server_2] |
| 34 |
include/assert.inc [The stage should be "Multi-primary Switch: waiting on another member step completion"] |
| 35 |
include/assert.inc [The estimated work is 1] |
| 36 |
include/assert.inc [The completed work is 0] |
| 37 |
[connection server1] |
| 38 |
SET DEBUG_SYNC='now SIGNAL waiting'; |
| 39 |
SET @@GLOBAL.DEBUG='-d,group_replication_before_message_broadcast'; |
| 40 |
[connection server_1_1] |
| 41 |
include/assert.inc [The stage should be "Multi-primary Switch: waiting for pending transactions to finish"] |
| 42 |
include/assert.inc [The estimated work is 2] |
| 43 |
include/assert.inc [The completed work is 1] |
| 44 |
|
| 45 |
# 2. Lock table t1 on a secondary (server2) |
| 46 |
# Commit the last transaction on server1 |
| 47 |
# On the locked server the stage is: applying buffered transactions |
| 48 |
[connection server_2_1] |
| 49 |
SET @@GLOBAL.read_only= 0; |
| 50 |
LOCK TABLE t1 READ; |
| 51 |
[connection server_1] |
| 52 |
COMMIT; |
| 53 |
[connection server_2] |
| 54 |
include/assert.inc [The stage should be "Multi-primary Switch: applying buffered transactions"] |
| 55 |
include/assert.inc [The estimated work is 1] |
| 56 |
include/assert.inc [The completed work is 0] |
| 57 |
|
| 58 |
# 3. Block the stop process of the action using a debug point |
| 59 |
# Unlock the table on server 2 |
| 60 |
# Check it is stuck in the wait for other member to finish stage |
| 61 |
SET @@GLOBAL.DEBUG= '+d,group_replication_block_group_action_stop'; |
| 62 |
[connection server_2_1] |
| 63 |
UNLOCK TABLES; |
| 64 |
[connection server1] |
| 65 |
include/assert.inc [The stage should be "Multi-primary Switch: waiting for operation to complete on all members"] |
| 66 |
include/assert.inc [The estimated work is 2] |
| 67 |
include/assert.inc [The completed work is 1] |
| 68 |
[connection server_2] |
| 69 |
include/assert.inc [The stage should be "Multi-primary Switch: waiting for operation to complete on all members"] |
| 70 |
include/assert.inc [The estimated work is 2] |
| 71 |
include/assert.inc [The completed work is 1] |
| 72 |
|
| 73 |
# 4. Unblock the debug point |
| 74 |
# Check the action terminates and no stages appear |
| 75 |
SET DEBUG_SYNC= "now SIGNAL signal.action_stop_continue"; |
| 76 |
SET @@GLOBAL.DEBUG= '-d,group_replication_block_group_action_stop'; |
| 77 |
[connection server2] |
| 78 |
group_replication_switch_to_multi_primary_mode() |
| 79 |
Mode switched to multi-primary successfully. |
| 80 |
include/assert.inc [There is no stage present] |
| 81 |
[connection server1] |
| 82 |
include/assert.inc [There is no stage present] |
| 83 |
|
| 84 |
# 5. Cleanup |
| 85 |
DROP TABLE t1; |
| 86 |
include/group_replication_end.inc |