Debian Codegraph @

mysql-test/suite/group_replication/r/gr_consistent_reads_before_and_after.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 # 01. Create two tables on the group.
9 [connection server1]
10 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY);
11 CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY);
12 include/rpl_sync.inc
13
14 ############################################################
15 # 02. Lock table t1 on server2 to block a future update.
16 [connection server_2]
17 LOCK table t1 READ;
18
19 ############################################################
20 # 03. Execute transaction T1, the transaction will block on
21 # server2 due to the table lock.
22 [connection server1]
23 BEGIN;
24 INSERT INTO t1 VALUES (1);
25 INSERT INTO t2 VALUES (1);
26 COMMIT;
27
28 ############################################################
29 # 04. Wait until T1 is delivered to server2.
30 [connection server2]
31
32 ############################################################
33 # 05. Execute a write transaction T2 on server2 with
34 # group_replication_consistency= 'BEFORE_AND_AFTER' , it
35 # will wait for T1 commit and will make new transactions
36 # wait for T2.
37 [connection server_2_1]
38 SET @@SESSION.group_replication_consistency= 'BEFORE_AND_AFTER';
39 UPDATE t2 SET c1=99 WHERE c1=1;
40 [connection server2]
41
42 ############################################################
43 # 06. Force server1 to block between T2 prepare and commit.
44 [connection server_1]
45 SET @@GLOBAL.DEBUG= '+d,group_replication_wait_on_after_applier_prepare';
46
47 ############################################################
48 # 07. Unblock T1 on server2.
49 [connection server_2]
50 UNLOCK TABLES;
51 [connection server_2_1]
52 SET @@SESSION.group_replication_consistency= DEFAULT;
53
54 ############################################################
55 # 08. Wait until T2 reaches prepare on server1.
56 [connection server_1]
57 SET DEBUG_SYNC= "now WAIT_FOR signal.after_applier_prepare_waiting";
58
59 ############################################################
60 # 09. Now that T2 is prepared on server1 but it is not yet
61 # committed, new transactions (T3) are hold on server1.
62 [connection server_1_1]
63 SELECT COUNT(*) AS count FROM t2 WHERE c1=99;
64 [connection server1]
65
66 ############################################################
67 # 10. Unblock T2 prepare on server1.
68 [connection server_1]
69 SET DEBUG_SYNC= 'now SIGNAL signal.after_applier_prepare_continue';
70 SET @@GLOBAL.DEBUG= '-d,group_replication_wait_on_after_applier_prepare';
71 [connection server_1_1]
72 count
73 1
74
75 ############################################################
76 # 11. Validate data.
77 [connection server1]
78 include/assert.inc ['There is 1 value in table t1']
79 include/assert.inc ['There is 1 value in table t2']
80 [connection server2]
81 include/assert.inc ['There is 1 value in table t1']
82 include/assert.inc ['There is 1 value in table t2']
83 include/diff_tables.inc [server1:t1, server2:t1]
84 include/diff_tables.inc [server1:t2, server2:t2]
85
86 ############################################################
87 # 12. Clean up.
88 [connection server1]
89 DROP TABLE t1;
90 DROP TABLE t2;
91 include/group_replication_end.inc