| 1 |
include/group_replication.inc [rpl_server_count=2] |
| 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 and create table t1 |
| 8 |
[connection server1] |
| 9 |
include/start_and_bootstrap_group_replication.inc |
| 10 |
CREATE TABLE test.t1 (a int primary key); |
| 11 |
|
| 12 |
# 2. Join server2 to group |
| 13 |
[connection server_2] |
| 14 |
include/start_group_replication.inc |
| 15 |
|
| 16 |
# 3. Lock tables to allow create backlog |
| 17 |
LOCK TABLES t1 READ; |
| 18 |
|
| 19 |
# 4. Execute transaction on primary server |
| 20 |
[connection server1] |
| 21 |
INSERT INTO t1 VALUES (1); |
| 22 |
|
| 23 |
# 5. Server2 will certify transaction but won't apply due lock tables |
| 24 |
[connection server2] |
| 25 |
|
| 26 |
# 6. Stop primary server and primary election will occur |
| 27 |
[connection server1] |
| 28 |
include/stop_group_replication.inc |
| 29 |
|
| 30 |
# 7. Set wait_timeout to 5 seconds |
| 31 |
[connection server2] |
| 32 |
SET @@SESSION.wait_timeout = 5; |
| 33 |
|
| 34 |
# 8. Execute a statement that will be put on hold |
| 35 |
SET @@SESSION.group_replication_consistency= BEFORE_ON_PRIMARY_FAILOVER; |
| 36 |
SELECT * FROM t1; |
| 37 |
|
| 38 |
# 9. Validate statement is on hold |
| 39 |
[connection server_2] |
| 40 |
|
| 41 |
# 10. Sleep for 10 seconds to connection on hold exceed wait timeout |
| 42 |
|
| 43 |
# 11. Reap with timeout error on pending statement |
| 44 |
[connection server2] |
| 45 |
ERROR HY000: Timeout exceeded for held statement while new Group Replication primary member is applying backlog. |
| 46 |
include/rpl_reconnect.inc |
| 47 |
|
| 48 |
# 12. UNLOCK tables to allow apply backlog |
| 49 |
[connection server_2] |
| 50 |
UNLOCK TABLES; |
| 51 |
|
| 52 |
# 13. Cleanup |
| 53 |
[connection server2] |
| 54 |
include/gr_wait_for_member_state.inc |
| 55 |
DROP TABLE t1; |
| 56 |
include/stop_group_replication.inc |
| 57 |
[connection server1] |
| 58 |
SET SESSION sql_log_bin= 0; |
| 59 |
DROP TABLE t1; |
| 60 |
SET SESSION sql_log_bin= 1; |
| 61 |
include/group_replication_end.inc |