Debian Codegraph @

mysql-test/suite/group_replication/r/gr_primary_failover_consistency_wait_backlog_applied.result

raw
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 INSERT INTO t1 VALUES (1);
12
13 # 2. Join server2 to group and lock tables t1
14 [connection server_2]
15 include/start_group_replication.inc
16 LOCK TABLES t1 READ;
17
18 # 3. Execute transaction on primary server
19 [connection server1]
20 INSERT INTO t1 VALUES (2);
21
22 # 4. Server2 will certify transaction but won't apply due lock tables
23 [connection server2]
24
25 # 5. Execute group_replication_set_as_primary to appoint server2 as
26 # primary
27 [connection server1]
28 SELECT group_replication_set_as_primary("MEMBER2_UUID");
29
30 # 6. Validate that primary election is executing
31 [connection server2]
32
33 # 7. A read statement to new primary will be put on hold until all
34 # backlog's are applied
35 SET @@SESSION.group_replication_consistency= BEFORE_ON_PRIMARY_FAILOVER;
36 SELECT COUNT(*)=1 FROM t1 WHERE a = 2;
37
38 # 8. Validate statement is on hold
39 [connection server_2]
40 # 9. Statements aren't held when executed on a secondary
41 [connection server_1]
42 SELECT * FROM t1;
43 a
44 1
45 2
46
47 # 10. UNLOCK tables to allow backlog to be applied
48 [connection server_2]
49 UNLOCK TABLES;
50
51 # 11. Reap with success read of last value inserted on group
52 [connection server2]
53 COUNT(*)=1
54 1
55 SET @@SESSION.group_replication_consistency= DEFAULT;
56
57 # 12. Reap with success execution of set as primary server2
58 [connection server1]
59 group_replication_set_as_primary("MEMBER2_UUID")
60 Primary server switched to: MEMBER2_UUID
61
62 # 13. Lock tables on next primary to have backlog to apply
63 [connection server_1]
64 LOCK TABLES t1 READ;
65
66 # 14. Insert data on table to create backlog on server1
67 [connection server2]
68 INSERT INTO t1 VALUES (3);
69
70 # 15. Server1 will certify transaction but won't apply due lock tables
71 [connection server1]
72
73 # 16. Execute set as primary to run a primary election
74 [connection server2]
75 SELECT group_replication_set_as_primary("MEMBER1_UUID");
76
77 # 17. Validate an primary election is executing
78 [connection server1]
79
80 # 18. A write statement to new primary will be put on hold until apply all
81 # backlog
82 SET @@SESSION.group_replication_consistency= BEFORE_ON_PRIMARY_FAILOVER;
83 INSERT INTO t1 VALUES (4);;
84
85 # 19. Validate statement is on hold
86 [connection server_1]
87 # 20. Statements aren't held when executed on a secondary
88 [connection server_2]
89 SELECT * FROM t1;
90 a
91 1
92 2
93 3
94
95 # 21. UNLOCK tables to allow apply backlog
96 [connection server_1]
97 UNLOCK TABLES;
98
99 # 22. Reap with success insert after backlog is applied
100 [connection server1]
101
102 # 23. Cleanup
103 SET @@SESSION.group_replication_consistency= DEFAULT;
104 DROP TABLE t1;
105 [connection server2]
106 group_replication_set_as_primary("MEMBER1_UUID")
107 Primary server switched to: MEMBER1_UUID
108 include/group_replication_end.inc