| 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 |
|
| 7 |
# 1. Bootstrap group on server 1 |
| 8 |
[connection server1] |
| 9 |
include/start_and_bootstrap_group_replication.inc |
| 10 |
|
| 11 |
# 2. Join server2 to group |
| 12 |
[connection server_2] |
| 13 |
include/start_group_replication.inc |
| 14 |
|
| 15 |
# 3. Set group_replication_consistency to BEFORE_ON_PRIMARY_FAILOVER on |
| 16 |
# global scope, so new connections have it |
| 17 |
SET @@GLOBAL.group_replication_consistency= BEFORE_ON_PRIMARY_FAILOVER; |
| 18 |
|
| 19 |
# 4. On server 2 create a slave connection to server 3 |
| 20 |
CHANGE REPLICATION SOURCE TO SOURCE_HOST='localhost', SOURCE_USER='root', SOURCE_PORT=SERVER_3_PORT for channel 'ch3_2'; |
| 21 |
Warnings: |
| 22 |
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 23 |
Note 1760 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. |
| 24 |
include/start_slave.inc [FOR CHANNEL 'ch3_2'] |
| 25 |
SET @@GLOBAL.group_replication_consistency= EVENTUAL; |
| 26 |
|
| 27 |
# 5. Create table t1 an t2 on server3 and replicate to group |
| 28 |
[connection server3] |
| 29 |
CREATE TABLE test.t1 (a int primary key); |
| 30 |
CREATE TABLE test.t2 (a int primary key); |
| 31 |
include/sync_slave_sql_with_master.inc |
| 32 |
include/sync_slave_sql_with_master.inc |
| 33 |
|
| 34 |
# 6. Pause applier threads to hold primary election (on wait |
| 35 |
# for stabilizing transactions from former primaries) |
| 36 |
[connection server_2] |
| 37 |
SET @@GLOBAL.DEBUG='+d,block_applier_updates'; |
| 38 |
|
| 39 |
# 7. Execute transaction on group |
| 40 |
[connection server1] |
| 41 |
INSERT INTO t1 VALUES (1); |
| 42 |
|
| 43 |
# 8. Server2 will certify transaction but won't apply due to |
| 44 |
# paused applier threads. |
| 45 |
[connection server2] |
| 46 |
SET DEBUG_SYNC = "now WAIT_FOR applier_read_blocked"; |
| 47 |
|
| 48 |
# 9. Execute group_replication_switch_to_single_primary_mode to appoint |
| 49 |
# server2 as primary on single primary mode group |
| 50 |
[connection server1] |
| 51 |
SELECT group_replication_switch_to_single_primary_mode("MEMBER2_UUID"); |
| 52 |
|
| 53 |
# 10. Validate that primary election is executing |
| 54 |
[connection server2] |
| 55 |
|
| 56 |
# 11. A read statement to new primary will be put on hold until all |
| 57 |
# backlog's are applied |
| 58 |
SET @@SESSION.group_replication_consistency= BEFORE_ON_PRIMARY_FAILOVER; |
| 59 |
SELECT COUNT(*)=1 FROM t1 WHERE a = 1; |
| 60 |
|
| 61 |
# 12. Validate statement is on hold |
| 62 |
[connection server_2] |
| 63 |
LOCK TABLES t1 READ; |
| 64 |
SET @@GLOBAL.DEBUG='-d,block_applier_updates'; |
| 65 |
SET DEBUG_SYNC = "now SIGNAL resume_applier_read"; |
| 66 |
|
| 67 |
# 13. Statement executed on server3 |
| 68 |
[connection server3] |
| 69 |
INSERT INTO t2 VALUES (1); |
| 70 |
|
| 71 |
# 14. Transaction from server3 will be held until backlog is applied |
| 72 |
[connection server_2_1] |
| 73 |
|
| 74 |
# 15. Table t2 will be empty until backlog is applied |
| 75 |
include/assert.inc ['There are no values in table t2'] |
| 76 |
|
| 77 |
# 16. UNLOCK tables to allow backlog to be applied |
| 78 |
[connection server_2] |
| 79 |
UNLOCK TABLES; |
| 80 |
|
| 81 |
# 17. Reap with success read of last value inserted on group |
| 82 |
[connection server2] |
| 83 |
COUNT(*)=1 |
| 84 |
1 |
| 85 |
SET @@SESSION.group_replication_consistency= DEFAULT; |
| 86 |
[connection server_2] |
| 87 |
SET DEBUG_SYNC= 'RESET'; |
| 88 |
|
| 89 |
# 18. Reap with success execution of set as primary server2 |
| 90 |
[connection server1] |
| 91 |
group_replication_switch_to_single_primary_mode("MEMBER2_UUID") |
| 92 |
Mode switched to single-primary successfully. |
| 93 |
|
| 94 |
# 19. Server2 applied all backlog, table t2 has the data |
| 95 |
|
| 96 |
# 20. Cleanup |
| 97 |
[connection server3] |
| 98 |
DROP TABLE t1; |
| 99 |
DROP TABLE t2; |
| 100 |
include/sync_slave_sql_with_master.inc |
| 101 |
[connection server3] |
| 102 |
include/sync_slave_sql_with_master.inc |
| 103 |
[connection server2] |
| 104 |
SET @@GLOBAL.group_replication_consistency= DEFAULT; |
| 105 |
STOP REPLICA FOR CHANNEL 'ch3_2'; |
| 106 |
RESET REPLICA ALL FOR CHANNEL 'ch3_2'; |
| 107 |
[connection server3] |
| 108 |
RESET MASTER; |
| 109 |
include/group_replication_end.inc |