Debian Codegraph @

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

raw
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 [connection server1]
7 SET SESSION sql_log_bin= 0;
8 include/gtid_utils.inc
9 SET SESSION sql_log_bin= 1;
10 [connection server2]
11 SET SESSION sql_log_bin= 0;
12 include/gtid_utils.inc
13 SET SESSION sql_log_bin= 1;
14
15 ############################################################
16 # 1. Create a table on the group.
17 ############################################################
18 [connection server1]
19 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
20 include/rpl_sync.inc
21
22 ############################################################
23 # 2. Try to stop Group Replication in the middle of a ongoing
24 # transaction. It should throw error
25 # ER_LOCK_OR_ACTIVE_TRANSACTION
26 ############################################################
27 BEGIN;
28 INSERT INTO t1 VALUES (2);
29 STOP GROUP_REPLICATION;
30 ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
31 include/assert.inc [GTID_EXECUTED must contain 3 group transactions]
32 [connection server_1]
33 include/assert.inc [There is no value 2 in table t1]
34 [connection server1]
35 COMMIT;
36 include/rpl_sync.inc
37 include/assert.inc [There is a value 2 in table t1 on server1]
38 include/assert.inc [GTID_EXECUTED must contain 4 group transactions]
39 [connection server2]
40 include/assert.inc [There is a value 2 in table t1 on server2]
41 include/assert.inc [GTID_EXECUTED must contain 4 group transactions]
42
43 ############################################################
44 # 3. Stop Group Replication while GTID_NEXT is specified
45 # and check an error is thrown to prove that
46 # STOP GROUP_REPLICATION does not create any
47 # implicit commits.
48 ############################################################
49 [connection server1]
50 SET GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb:1';
51 STOP GROUP_REPLICATION;
52 ERROR HY000: Can't execute the given command when @@SESSION.GTID_NEXT == 'UUID:NUMBER'.
53 [connection server_1]
54 include/assert.inc [GTID_EXECUTED must contain 4 group transactions]
55 include/assert.inc [GTID_OWNED is still set since aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb:1 transaction was not committed]
56 include/stop_group_replication.inc
57 [connection server1]
58 COMMIT;
59 SET GTID_NEXT= AUTOMATIC;
60 include/assert.inc [GTID_OWNED is empty after committing aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb:1]
61 include/assert.inc [GTID_EXECUTED must contain 4 group transactions and 1 local transaction]
62
63 ############################################################
64 # 4. Try to Start Group Replication in the middle of a ongoing
65 # transaction. It should throw error
66 # ER_LOCK_OR_ACTIVE_TRANSACTION
67 ############################################################
68 [connection server1]
69 BEGIN;
70 INSERT INTO t1 VALUES (4);
71 START GROUP_REPLICATION;
72 ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
73 include/assert.inc [GTID_EXECUTED must still contain 4 group transactions and 1 local transaction]
74 [connection server_2]
75 include/assert.inc [There is no value 4 in table t1]
76 [connection server1]
77 COMMIT;
78 include/assert.inc [There is a value 4 in table t1 on server1]
79 include/assert.inc [GTID_EXECUTED must contain 4 group transactions and 2 local transaction]
80 DROP TABLE t1;
81 RESET MASTER;
82
83 ##################################################################
84 # 5. Try to start Group Replication while there are ongoing
85 # transaction in parallel that does not have any GR compatible
86 # DMLs (no write set that goes to certification). It should be
87 # commit hook error.
88 ##################################################################
89 SET SESSION sql_log_bin= 0;
90 CALL mtr.add_suppression("Failed to extract the set of items written");
91 CALL mtr.add_suppression("Run function 'before_commit' in plugin 'group_replication' failed");
92 CREATE TABLE t_without_primary_key(i INT);
93 SET SESSION sql_log_bin= 1;
94 BEGIN;
95 INSERT INTO t_without_primary_key VALUES (1);
96 [connection server_1]
97 include/start_group_replication.inc
98 [connection server1]
99 COMMIT;
100 ERROR HY000: Error on observer while running replication hook 'before_commit'.
101 SET SESSION sql_log_bin= 0;
102 DROP TABLE t_without_primary_key;
103 SET SESSION sql_log_bin= 1;
104
105 ############################################################
106 # 6. Start Group Replication while GTID_NEXT is specified.
107 # It shall fail leaving GTID_NEXT untouched
108 ############################################################
109 include/stop_group_replication.inc
110 DROP TABLE t1;
111 RESET MASTER;
112 [connection server1]
113 SET GTID_NEXT= 'aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb:1';
114 START GROUP_REPLICATION;
115 ERROR HY000: Can't execute the given command when @@SESSION.GTID_NEXT == 'UUID:NUMBER'.
116 [connection server_1]
117 include/assert.inc [GTID_EXECUTED is empty]
118 include/assert.inc [GTID_OWNED is still set since the ongoing transaction was not committed]
119 [connection server1]
120 COMMIT;
121 SET GTID_NEXT= AUTOMATIC;
122 include/assert.inc [GTID_OWNED is empty after committing aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb:1]
123 include/assert.inc [GTID_EXECUTED must contain only the local transaction]
124 RESET MASTER;
125 include/start_group_replication.inc
126 include/assert.inc [GTID_EXECUTED must contain 6 group transactions]
127
128 #################################################################
129 # 7. Verify that if a session is in lock_table_mode (exclusively
130 # acquired a lock on a table), stop group replication command
131 # is not allowed from the session.
132 #################################################################
133 [connection server2]
134 LOCK table t1 WRITE;
135 [connection server1]
136 INSERT INTO t1 values (6);
137 [connection server2]
138 STOP GROUP_REPLICATION;
139 ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
140 UNLOCK tables;
141
142 #################################################################
143 # 8. Verify that if a session is in lock_table_mode (exclusively
144 # acquired a lock on a table), start group replication command
145 # is not allowed from the session.
146 #################################################################
147 [connection server2]
148 include/stop_group_replication.inc
149 [connection server2]
150 LOCK table t1 WRITE;
151 START GROUP_REPLICATION;
152 ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
153 UNLOCK tables;
154 include/start_group_replication.inc
155
156 ############################################################
157 # 9. Clean up
158 ############################################################
159 [connection server1]
160 DROP TABLE t1;
161 [connection server1]
162 SET SESSION sql_log_bin= 0;
163 include/gtid_utils_end.inc
164 SET SESSION sql_log_bin= 1;
165 [connection server2]
166 SET SESSION sql_log_bin= 0;
167 include/gtid_utils_end.inc
168 SET SESSION sql_log_bin= 1;
169 include/group_replication_end.inc