Debian Codegraph @

mysql-test/suite/group_replication/r/gr_read_uncommitted_isolation.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 ## 1. Set global isolation level to 'READ-UNCOMMITTED' on server1, server2
8 [connection server1]
9 SET @transaction_isolation_global_orig = @@global.transaction_isolation;
10 SET GLOBAL transaction_isolation= 'READ-UNCOMMITTED';
11 SET @transaction_isolation_session_orig = @@global.transaction_isolation;
12 SET SESSION transaction_isolation= 'READ-UNCOMMITTED';
13 [connection server2]
14 SET @transaction_isolation_global_orig = @@global.transaction_isolation;
15 SET GLOBAL transaction_isolation= 'READ-UNCOMMITTED';
16 SET @transaction_isolation_session_orig = @@global.transaction_isolation;
17 SET SESSION transaction_isolation= 'READ-UNCOMMITTED';
18
19 ## 2. Create table and insert some data
20 [connection server1]
21 CREATE TABLE t1 (a INT PRIMARY KEY);
22 INSERT INTO t1 VALUES (10),(20);
23 include/rpl_sync.inc
24
25 ## 3.1 Set a debug sync before broadcast message to group on server1
26 ## Commit a transaction that will be blocked before broadcast.
27 [connection server_1]
28 SET @debug_save= @@GLOBAL.DEBUG;
29 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
30 BEGIN;
31 UPDATE t1 set a= 1 where a= 10;
32 COMMIT;
33
34 ## 3.2 Wait until server_1 connection reaches the
35 ## 'group_replication_before_message_broadcast' debug sync point.
36 [connection server1]
37 include/assert.inc ['Table t1 should contain a row with a=1']
38 include/assert.inc ['Table t1 should contain a row with a=20']
39
40 ## 3.3. Execute a transaction on server2, that will reach first
41 ## certification, since server_1 is blocked before broadcast.
42 [connection server2]
43 BEGIN;
44 UPDATE t1 SET a=3 WHERE a=10;
45 DELETE FROM t1 where a=20;
46 COMMIT;
47
48 ## 3.4 Signal the waiting thread on server1 to resume.
49 [connection server1]
50 SET DEBUG_SYNC='now SIGNAL waiting';
51 SET @@GLOBAL.DEBUG= @debug_save;
52
53 ## 3.5 It will end up in an error stating that it was aborted, since
54 ## transactions are conflicting and server2 was ordered first.
55 [connection server2]
56 include/sync_slave_sql_with_master.inc
57 [connection server_1]
58 ERROR 40000: Plugin instructed the server to rollback the current transaction.
59
60 ## 3.6 ROLL BACK a transaction on server1
61 [connection server_1]
62 BEGIN;
63 UPDATE t1 set a= 30 where a= 3;
64 ROLLBACK;
65
66 ## 3.7 Execute a transaction on server2
67 [connection server2]
68 BEGIN;
69 UPDATE t1 SET a=10 WHERE a=3;
70 COMMIT;
71 include/sync_slave_sql_with_master.inc
72
73 ## 3.8 Transaction originated on server2 will be successful as ROLLED BACK
74 ## transactions are not broadcasted.
75 [connection server_1]
76 ## Validating data on server1 and server2
77 [connection server1]
78 include/assert.inc ['Table t1 has a row with a=10']
79 include/assert.inc ['Table t1 will contain 1 row after the above execution']
80 include/diff_tables.inc [server1:test.t1, server2:test.t1]
81
82 ## Checking the positive case in which there is no conflict.
83
84 ## 4.1 Commit a transaction that will be blocked before broadcast.
85 ## Set a debug sync before broadcast message to group on server1
86 [connection server_1]
87 SELECT * FROM t1;
88 a
89 10
90 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
91 BEGIN;
92 INSERT INTO t1 VALUES (2);
93 COMMIT;
94
95 ## 4.2 Wait until server_1 connection reaches the
96 ## group_replication_before_message_broadcast debug sync point.
97 [connection server1]
98
99 ## 4.3 Execute a non-conflicting transaction on server2, that will reach
100 ## first certification, since server_1 is blocked before broadcast.
101 [connection server2]
102 UPDATE t1 SET a=1 where a=10;
103 include/sync_slave_sql_with_master.inc
104
105 ## 4.4 Signal the waiting thread on server_1 to resume.
106 [connection server1]
107 SET DEBUG_SYNC='now SIGNAL waiting';
108 SET @@GLOBAL.DEBUG= @debug_save;
109
110 ## 4.5 Transaction will be executed
111 [connection server_1]
112 include/rpl_sync.inc
113
114 ## 5. Assert that number of certified transactions are the
115 ## expected ones and validate data on server1, server2
116 [connection server1]
117 include/assert.inc ['Table t1 should contain a row with a=1']
118 include/assert.inc ['Table t1 should contain a row with a=2']
119 include/assert.inc ['Table t1 will contain 2 rows after the above execution']
120 include/assert.inc ['The value of Count_Transactions_Checked should be 7 after starting group replication']
121 include/assert.inc ['The value of Count_Conflicts_Detected should be 1 after starting group replication']
122 include/diff_tables.inc [server1:test.t1, server2:test.t1]
123
124 ## 6. Clean up.
125 SET GLOBAL transaction_isolation= @transaction_isolation_global_orig;
126 SET SESSION transaction_isolation= @transaction_isolation_session_orig;
127 SET DEBUG_SYNC='RESET';
128 [connection server2]
129 SET GLOBAL transaction_isolation= @transaction_isolation_global_orig;
130 SET SESSION transaction_isolation= @transaction_isolation_session_orig;
131 DROP TABLE t1;
132 include/group_replication_end.inc