Debian Codegraph @

mysql-test/suite/group_replication/r/gr_primary_key_conflict_xa.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 PRIMARY KEY);
11 include/rpl_sync.inc
12
13 ############################################################
14 # 2. Set a debug sync before broadcast message to group on
15 # connection server_1.
16 # Commit a transaction that will be block before broadcast.
17 [connection server_1]
18 SET @debug_save= @@GLOBAL.DEBUG;
19 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
20 XA START 'trx';
21 INSERT INTO t1 VALUES (1);
22 XA END 'trx';
23 XA PREPARE 'trx';
24
25 ############################################################
26 # 3. Wait until server_1 connection reaches the
27 # group_replication_before_message_broadcast debug sync point.
28 [connection server1]
29
30 ############################################################
31 # 4. Execute a transaction on server2, that will reach first
32 # certification, since server_1 is blocked before broadcast.
33 [connection server2]
34 INSERT INTO t1 VALUES (1);
35
36 ############################################################
37 # 5. Signal the waiting thread on server_1 to resume.
38 [connection server1]
39 SET DEBUG_SYNC='now SIGNAL waiting';
40 SET @@GLOBAL.DEBUG= @debug_save;
41
42 ############################################################
43 # 6. It will end up in an error stating that it was aborted,
44 # since transactions are conflicting and server2 was
45 # ordered first.
46 [connection server_1]
47 ERROR 40000: Plugin instructed the server to rollback the current transaction.
48 XA COMMIT 'trx';
49 ERROR XAE04: XAER_NOTA: Unknown XID
50
51 ############################################################
52 # 7. Assert that number of certified transactions are the
53 # expected ones.
54 [connection server1]
55 include/assert.inc [The value of Count_Transactions_Checked should be 3 after starting group replication]
56 include/assert.inc [The value of Count_Conflicts_Detected should be 1 after starting group replication]
57
58 ############################################################
59 # Checking the positive case in which there is no conflict.
60 ############################################################
61
62 ############################################################
63 # 1. Set a debug sync before broadcast message to group on
64 # connection server_1.
65 # Commit a transaction that will be block before broadcast.
66 [connection server_1]
67 SET @@GLOBAL.DEBUG='d,group_replication_before_message_broadcast';
68 XA START 'trx2';
69 INSERT INTO t1 VALUES (2);
70 XA END 'trx2';
71 XA PREPARE 'trx2';
72
73 ############################################################
74 # 2. Wait until server_1 connection reaches the
75 # group_replication_before_message_broadcast debug sync point.
76 [connection server1]
77
78 ############################################################
79 # 3. Execute a transaction on server2, that will reach first
80 # certification, since server_1 is blocked before broadcast.
81 [connection server2]
82 INSERT INTO t1 VALUES (3);
83 include/sync_slave_sql_with_master.inc
84
85 ############################################################
86 # 4. Signal the waiting thread on server_1 to resume.
87 [connection server1]
88 SET DEBUG_SYNC='now SIGNAL waiting';
89 SET @@GLOBAL.DEBUG= @debug_save;
90
91 ########################################################################
92 # 5. It will execute without error as the conflicting transactions have
93 # been removed.
94 [connection server_1]
95 XA COMMIT 'trx2';
96 include/rpl_sync.inc
97
98 ############################################################
99 # 6. Assert that number of certified transactions are the
100 # expected ones.
101 [connection server1]
102 include/assert.inc [Table t1 will contain row after the above execution]
103 include/assert.inc [Table t1 will contain row after the above execution]
104 include/assert.inc [Table t1 will contain row after the above execution]
105 include/assert.inc [Table t1 will contain 3 rows after the above execution]
106 include/assert.inc [The value of Count_Transactions_Checked should be 6 after starting group replication]
107 include/assert.inc [The value of Count_Conflicts_Detected should be 1 after starting group replication]
108
109 ############################################################
110 # Clean up.
111 DROP TABLE t1;
112 include/group_replication_end.inc