Debian Codegraph @

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

raw
1 # Whenever these two Managers require different orders, it results in
2 # a deadlock. For example, suppose the following happens:
3 # * The inbound channel receives T1 before T2.
4 # * T2 is certified first. Then a view_change occurs. Then T1 is
5 # certified.
6 # This leads to a deadlock:
7 # * When T1 is about to commit, it will invoke the Ticket Manager,
8 # which waits for the view_change.
9 # * When the view_change is about to commit, it will invoke the Ticket
10 # Manager, which waits for T2 to commit.
11 # * When T2 is about to commit, it will invoke the Commit Order
12 # Manager, which will wait for T1 to commit.
13 # Therefore, this results in a wait cycle, i.e., deadlock.
14 #
15 # This rest to simulate the deadlock, through simulate_bgct_rpco_deadlock
16 # debug point, which will push additional bgc tickets on the primary
17 # (simulate view changes).
18 # Primary is not able to satisfy rpco due to random bgct changes in bgc
19 # ticketing queue and reordering of transactions before verdict. It
20 # detects this situation and breaks rpco.
21
22 --source include/big_test.inc
23 --source include/have_debug.inc
24 --source include/only_mts_replica_parallel_type_logical_clock.inc
25 --let $option_name = replica_parallel_workers
26 --let $option_operator = >
27 --let $option_value = 1
28 --source include/only_with_option.inc
29 --let $group_replication_group_name= aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
30 --source include/have_group_replication_plugin.inc
31 --let $rpl_group_replication_single_primary_mode =1
32 --let $rpl_skip_group_replication_start= 1
33 --let $rpl_server_count= 4
34 --source include/group_replication.inc
35
36
37 --echo
38 --echo ############################################################
39 --echo # 1. Bootstrap group on server1. Configure servers.
40 --echo # Start an inbound channel that replicates from server4.
41 --let $rpl_connection_name= server1
42 --source include/rpl_connection.inc
43 --source include/start_and_bootstrap_group_replication.inc
44
45 SET SESSION sql_log_bin= 0;
46 call mtr.add_suppression("The transaction '[a-z0-9\-]*:[0-9]*' will commit out of order with respect to its source to follow the group global order.");
47 SET SESSION sql_log_bin= 1;
48
49 --let $debug_point= simulate_bgct_rpco_deadlock
50 --source include/add_debug_point.inc
51
52 --replace_result $SERVER_MYPORT_4 SERVER_4_PORT
53 --eval CHANGE REPLICATION SOURCE TO SOURCE_HOST='127.0.0.1', SOURCE_USER='root', SOURCE_AUTO_POSITION=1, SOURCE_PORT=$SERVER_MYPORT_4 FOR CHANNEL 'ch1'
54
55 --let $rpl_channel_name='ch1'
56 --source include/start_slave.inc
57 --let $rpl_channel_name=
58
59 --let $rpl_connection_name= server2
60 --source include/rpl_connection.inc
61 --source include/start_group_replication.inc
62
63 --let $rpl_connection_name= server3
64 --source include/rpl_connection.inc
65 --source include/start_group_replication.inc
66
67
68 --echo
69 --echo ############################################################
70 --echo # 2. Schedule transactions in inbound replication channel
71 --let $rpl_connection_name= server4
72 --source include/rpl_connection.inc
73
74 CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 LONGTEXT);
75
76 --disable_query_log
77 --let $j= 0
78 --let $k= 0
79 while ($j < 100)
80 {
81 if ($k < 1) {
82 --eval INSERT INTO t1 VALUES ($j, repeat('a', 6000000));
83 }
84 if ($k >= 1) {
85 --eval INSERT INTO t1 VALUES ($j, 'a');
86 }
87 inc $j;
88 inc $k;
89 if ($k == 10)
90 {
91 --let $k= 0
92 }
93 }
94 --enable_query_log
95
96 DROP TABLE t1;
97
98
99 --echo
100 --echo ############################################################
101 --echo # 3. There must be 0 applier threads on server1 with the state
102 --echo # 'Waiting for Binlog Group Commit ticket'.
103 --let $rpl_connection_name= server1
104 --source include/rpl_connection.inc
105 --let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.threads WHERE PROCESSLIST_STATE='Waiting for Binlog Group Commit ticket'
106 --source include/wait_condition.inc
107
108 --let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
109 --let $assert_text = There were transactions that did commit out of order with respect to its source to follow the group global order
110 --let $assert_select = will commit out of order with respect to its source to follow the group global order
111 --let $assert_count_condition= >=1
112 --source include/assert_grep.inc
113
114
115 --echo
116 --echo ############################################################
117 --echo # 4. Clean up.
118 --let $rpl_connection_name= server4
119 --source include/rpl_connection.inc
120 --let $sync_slave_connection= server1
121 --source include/sync_slave_sql_with_master.inc
122
123 # sync all group members
124 --source include/rpl_sync.inc
125
126 --let $rpl_connection_name= server3
127 --source include/rpl_connection.inc
128 --source include/stop_group_replication.inc
129
130 --let $rpl_connection_name= server2
131 --source include/rpl_connection.inc
132 --source include/stop_group_replication.inc
133
134 --let $rpl_connection_name= server1
135 --source include/rpl_connection.inc
136 --let $debug_point= simulate_bgct_rpco_deadlock
137 --source include/remove_debug_point.inc
138 --let $rpl_channel_name='ch1'
139 --source include/stop_slave.inc
140 --let $rpl_channel_name=
141 RESET REPLICA ALL FOR CHANNEL 'ch1';
142
143 --source include/stop_group_replication.inc
144
145 --source include/group_replication_end.inc