Debian Codegraph @

mysql-test/suite/group_replication/r/gr_foreign_key_unique_conflict.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
7 ############################################################
8 # 1. Create a table on server1.
9 [connection server1]
10 CREATE TABLE t1 (c1 INT UNIQUE KEY NOT NULL);
11 CREATE TABLE t2 (c2 INT UNIQUE KEY NOT NULL, FOREIGN KEY (c2) REFERENCES t1(c1));
12 INSERT INTO t1 VALUES(1);
13 include/rpl_sync.inc
14
15 ############################################################
16 # 2. Checking the negative case in which there is a conflict.
17
18 ############################################################
19 # 0. Initial setup and checks.
20 [connection server1]
21 SET SESSION sql_log_bin= 0;
22 include/gtid_utils.inc
23 SET SESSION sql_log_bin= 1;
24 include/gtid_step_reset.inc
25
26 ############################################################
27 # 1. Set a debug sync before broadcast message to group on
28 # connection local_server_connection1.
29 [connection server1]
30 SET @debug_save= @@GLOBAL.DEBUG;
31 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
32
33 #####################################################################
34 # 2. Commit local_transaction that will be blocked before broadcast.
35 BEGIN;
36 INSERT INTO t2 VALUES (1);
37 COMMIT;
38
39 ############################################################
40 # 3. Wait until local transaction reaches the
41 # group_replication_before_message_broadcast debug sync point.
42 [connection server_1]
43
44 ############################################################
45 # 4. Execute a transaction on remote server, that will reach first
46 # certification, since transaction on the local server
47 # is blocked before broadcast.
48 [connection server2]
49 BEGIN;
50 UPDATE t1 SET c1=2 WHERE c1=1;
51 COMMIT;
52
53 ############################################################
54 # 5. Signal the waiting thread on local server to resume the
55 # transaction.
56 [connection server_1]
57 SET DEBUG_SYNC='now SIGNAL waiting';
58 SET @@GLOBAL.DEBUG= @debug_save;
59
60 ############################################################
61 # 6. Wait for remote transaction to be executed succesfully
62 on local server.
63 [connection server2]
64 include/sync_slave_sql_with_master.inc
65 ############################################################
66 # 7. If the test case is conflict scenario, local transaction
67 # will end up in an error stating that it was aborted,
68 # since transactions are conflicting and transaction on
69 # remote server was ordered first. If the test case is
70 # is positive scenario, no error will be seen here.
71 [connection server1]
72 ERROR 40000: Plugin instructed the server to rollback the current transaction.
73 [connection server1]
74 SET @@GLOBAL.DEBUG=@debug_save;
75 ############################################################
76 # 8. Sync everything
77 include/rpl_sync.inc
78 ############################################################
79 # 9. Assert that number of certified transactions are the
80 # expected ones.
81 include/assert.inc [The value of Count_Transactions_Checked should be 5 after starting group replication]
82 include/assert.inc [The value of Count_Conflicts_Detected should be 1 after starting group replication]
83 ############################################################
84 # 10. Assert that GTID is increased as expected
85 include/gtid_step_assert.inc [count=1, only_count=1]
86 [connection server1]
87 SET SESSION sql_log_bin= 0;
88 include/gtid_utils_end.inc
89 SET SESSION sql_log_bin= 1;
90 ############################################################
91 # 11. Cleanup (restore the connection back to original)
92 [connection server1]
93
94 ############################################################
95 # 3. Checking the positive case in which there is no conflict.
96 INSERT INTO t1 VALUES (5);
97
98 ############################################################
99 # 0. Initial setup and checks.
100 [connection server1]
101 SET SESSION sql_log_bin= 0;
102 include/gtid_utils.inc
103 SET SESSION sql_log_bin= 1;
104 include/gtid_step_reset.inc
105
106 ############################################################
107 # 1. Set a debug sync before broadcast message to group on
108 # connection local_server_connection1.
109 [connection server1]
110 SET @debug_save= @@GLOBAL.DEBUG;
111 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
112
113 #####################################################################
114 # 2. Commit local_transaction that will be blocked before broadcast.
115 BEGIN;
116 INSERT INTO t2 VALUES (5);
117 COMMIT;
118
119 ############################################################
120 # 3. Wait until local transaction reaches the
121 # group_replication_before_message_broadcast debug sync point.
122 [connection server_1]
123
124 ############################################################
125 # 4. Execute a transaction on remote server, that will reach first
126 # certification, since transaction on the local server
127 # is blocked before broadcast.
128 [connection server2]
129 BEGIN;
130 UPDATE t1 SET c1=6 WHERE c1=2;
131 COMMIT;
132
133 ############################################################
134 # 5. Signal the waiting thread on local server to resume the
135 # transaction.
136 [connection server_1]
137 SET DEBUG_SYNC='now SIGNAL waiting';
138 SET @@GLOBAL.DEBUG= @debug_save;
139
140 ############################################################
141 # 6. Wait for remote transaction to be executed succesfully
142 on local server.
143 [connection server2]
144 include/sync_slave_sql_with_master.inc
145 ############################################################
146 # 7. If the test case is conflict scenario, local transaction
147 # will end up in an error stating that it was aborted,
148 # since transactions are conflicting and transaction on
149 # remote server was ordered first. If the test case is
150 # is positive scenario, no error will be seen here.
151 [connection server1]
152 [connection server1]
153 SET @@GLOBAL.DEBUG=@debug_save;
154 ############################################################
155 # 8. Sync everything
156 include/rpl_sync.inc
157 ############################################################
158 # 9. Assert that number of certified transactions are the
159 # expected ones.
160 include/assert.inc [The value of Count_Transactions_Checked should be 8 after starting group replication]
161 include/assert.inc [The value of Count_Conflicts_Detected should be 1 after starting group replication]
162 ############################################################
163 # 10. Assert that GTID is increased as expected
164 include/gtid_step_assert.inc [count=2, only_count=1]
165 [connection server1]
166 SET SESSION sql_log_bin= 0;
167 include/gtid_utils_end.inc
168 SET SESSION sql_log_bin= 1;
169 ############################################################
170 # 11. Cleanup (restore the connection back to original)
171 [connection server1]
172
173 ############################################################
174 # 4. Check the data sanity.
175 [connection server1]
176 include/assert.inc [Table t2 will contain row after the above execution]
177 include/assert.inc [Table t1 will contain row after the above execution]
178 include/assert.inc [Table t1 will contain row after the above execution]
179 include/assert.inc [Table t2 will contain 1 rows after the above execution]
180 include/assert.inc [Table t1 will contain 2 rows after the above execution]
181
182 ############################################################
183 # 5. Clean up.
184 DROP TABLE t2;
185 DROP TABLE t1;
186 include/group_replication_end.inc