Debian Codegraph @

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

raw
1 include/group_replication.inc [rpl_server_count=3]
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 (100);
26 COMMIT;
27
28 ############################################################
29 # 04. Wait until T1 is delivered to server2.
30 [connection server2]
31
32 ############################################################
33 # 05. Execute a read transaction on server2 with
34 # group_replication_consistency= 'BEFORE' , it will wait
35 # for T1 commit.
36 [connection server_2_1]
37 SET @@SESSION.group_replication_consistency= 'BEFORE';
38 SELECT COUNT(*) AS count FROM t2 WHERE c1 >= 99;
39 [connection server2]
40
41 ############################################################
42 # 06. Execute a write transaction on server2 with
43 # group_replication_consistency= 'BEFORE' , it will wait
44 # for T1 commit.
45 [connection slave]
46 SET @@SESSION.group_replication_consistency= 'BEFORE';
47 UPDATE t2 SET c1=99 WHERE c1=100;
48 [connection server2]
49
50 ############################################################
51 # 07. Execute transaction T2 on server1, it will execute
52 # on servers 1 and 3.
53 # server2 will apply it in order not because of the
54 # consistency but due to --replica_preserve_commit_order
55 # or single thread applier which will make T2 be
56 # committed after the UPDATE.
57 [connection server1]
58 INSERT INTO t2 VALUES (2);
59 include/assert.inc ['There is a 2 in table t2']
60 [connection server3]
61
62 ############################################################
63 # 08. Unblock T1 on server2.
64 [connection server_2]
65 UNLOCK TABLES;
66 [connection server_2_1]
67 count
68 1
69 SET @@SESSION.group_replication_consistency= DEFAULT;
70 [connection slave]
71 SET @@SESSION.group_replication_consistency= DEFAULT;
72
73 ############################################################
74 # 09. Validate data.
75 [connection server2]
76 include/assert.inc ['There is a 1 in table t1']
77 include/assert.inc ['There is a 99 in table t2']
78 include/rpl_sync.inc
79 [connection server2]
80 include/assert.inc ['There is a 2 in table t2']
81 [connection server1]
82 include/assert.inc ['There is a 1 in table t1']
83 include/assert.inc ['There is a 99 in table t2']
84 include/assert.inc ['There is a 2 in table t2']
85 [connection server3]
86 include/assert.inc ['There is a 1 in table t1']
87 include/assert.inc ['There is a 99 in table t2']
88 include/assert.inc ['There is a 2 in table t2']
89 include/diff_tables.inc [server1:t1, server2:t1, server3:t1]
90 include/diff_tables.inc [server1:t2, server2:t2, server3:t2]
91
92 ############################################################
93 # 10. Clean up.
94 [connection server1]
95 DROP TABLE t1;
96 DROP TABLE t2;
97 include/group_replication_end.inc