Debian Codegraph @

mysql-test/suite/group_replication/t/gr_transaction_compatibility_basics.test

raw
1 ################################################################################
2 # Test that evaluates basics about transaction control when joining,
3 #
4 # Test:
5 # 0) The test requires two servers: M1 and M2.
6 # 1) Bootstrap start a group on M1 and execute some transactions.
7 # 2) Execute a local transaction on M2 and try to join. It fails.
8 # Verify the error messages are logged.
9 # 3) Test that the M2 can now join the group after the extra data
10 # is removed.
11 # 4) Verify all is fine. Check data in table on M2.
12 # 5) Clean up.
13 ################################################################################
14
15 --source include/big_test.inc
16 --let $group_replication_group_name= c645abc0-ebb9-11e5-a837-0800200c9a66
17 --source include/have_group_replication_plugin.inc
18 --let $rpl_skip_group_replication_start= 1
19 --source include/group_replication.inc
20 --let $errand_transaction_uuid= aaaaaaaa-bbbb-aaaa-bbbb-aaaaaaaaaaaa
21
22 # Suppress errors
23
24 --let $rpl_connection_name= server2
25 --source include/rpl_connection.inc
26
27 SET SESSION sql_log_bin= 0;
28 call mtr.add_suppression(".*The member contains transactions not present *.*");
29 SET SESSION sql_log_bin= 1;
30
31 --echo #
32 --echo # Setup the first member
33 --echo #
34
35 --let $rpl_connection_name= server1
36 --source include/rpl_connection.inc
37 --source include/start_and_bootstrap_group_replication.inc
38
39 # Add some data for recovery
40
41 CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
42 INSERT INTO t1 VALUES (1);
43
44 --let $assert_text= The first member has 3 transaction belonging to the group
45 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$group_replication_group_name:1-3";
46 --source include/assert.inc
47
48 --echo #
49 --echo # Verify that server 2 can't enter the group
50 --echo # Verify that error messages are logged.
51 --echo #
52
53 --let $rpl_connection_name= server2
54 --source include/rpl_connection.inc
55
56 --eval SET GTID_NEXT= "$errand_transaction_uuid:1"
57 CREATE TABLE t2 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
58 SET GTID_NEXT= "AUTOMATIC";
59
60 --let $assert_text= The member shall contain a local transaction
61 --let $assert_cond= "[SELECT @@GLOBAL.GTID_EXECUTED]" = "$errand_transaction_uuid:1";
62 --source include/assert.inc
63
64 --eval SET GLOBAL group_replication_group_name= "$group_replication_group_name"
65 --error ER_GROUP_REPLICATION_CONFIGURATION
66 START GROUP_REPLICATION;
67
68 --replace_regex /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][-+Z][0-9:]* *[0-9]* \[ERROR\] \[[^\]]*\] */DATE_TIME [ERROR] /
69 --let $grep_file=$MYSQLTEST_VARDIR/tmp/group_replication_transaction_compatibility_basics.err
70 --let $grep_pattern=This member has more executed transactions than those present in the group. Local transactions
71 --source include/grep_pattern.inc
72
73 --replace_regex /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][-+Z][0-9:]* *[0-9]* \[ERROR\] \[[^\]]*\] */DATE_TIME [ERROR] /
74 --let $grep_file=$MYSQLTEST_VARDIR/tmp/group_replication_transaction_compatibility_basics.err
75 --let $grep_pattern=The member contains transactions not present in the group. The member will now exit the group.
76 --source include/grep_pattern.inc
77
78 --echo #
79 --echo # Test that server 2 can now join after extra data is removed.
80 --echo #
81
82 #For precaution, wait for server 2 to leave before joining again.
83 --let $rpl_connection_name= server1
84 --source include/rpl_connection.inc
85
86 --let $group_replication_number_of_members= 1
87 --source include/gr_wait_for_number_of_members.inc
88
89 --let $rpl_connection_name= server2
90 --source include/rpl_connection.inc
91
92 DROP TABLE t2;
93 RESET MASTER;
94
95 --source include/start_group_replication.inc
96
97 --echo #
98 --echo # Verify all is fine
99 --echo #
100
101 --let $rpl_connection_name= server1
102 --source include/rpl_connection.inc
103
104 INSERT INTO t1 VALUES (2);
105
106 --source include/rpl_sync.inc
107
108 --let $rpl_connection_name= server2
109 --source include/rpl_connection.inc
110
111 --let $assert_text= 'There are two values in table t1'
112 --let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 2
113 --source include/assert.inc
114
115 --echo #
116 --echo # Cleaning up
117 --echo #
118
119 DROP TABLE t1;
120
121 --source include/group_replication_end.inc