File: gr_rpco_cert_order.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (145 lines) | stat: -rw-r--r-- 5,045 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Whenever these two Managers require different orders, it results in
# a deadlock. For example, suppose the following happens:
#  * The inbound channel receives T1 before T2.
#  * T2 is certified first. Then a view_change occurs. Then T1 is
#    certified.
# This leads to a deadlock:
#  * When T1 is about to commit, it will invoke the Ticket Manager,
#    which waits for the view_change.
#  * When the view_change is about to commit, it will invoke the Ticket
#    Manager, which waits for T2 to commit.
#  * When T2 is about to commit, it will invoke the Commit Order
#    Manager, which will wait for T1 to commit.
# Therefore, this results in a wait cycle, i.e., deadlock.
#
# This rest to simulate the deadlock, through simulate_bgct_rpco_deadlock
# debug point, which will push additional bgc tickets on the primary
# (simulate view changes).
# Primary is not able to satisfy rpco due to random bgct changes in bgc
# ticketing queue and reordering of transactions before verdict. It
# detects this situation and breaks rpco.

--source include/big_test.inc
--source include/have_debug.inc
--source include/only_mts_replica_parallel_type_logical_clock.inc
--let $option_name = replica_parallel_workers
--let $option_operator = >
--let $option_value = 1
--source include/only_with_option.inc
--let $group_replication_group_name= aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
--source include/have_group_replication_plugin.inc
--let $rpl_group_replication_single_primary_mode =1
--let $rpl_skip_group_replication_start= 1
--let $rpl_server_count= 4
--source include/group_replication.inc


--echo
--echo ############################################################
--echo # 1. Bootstrap group on server1. Configure servers.
--echo #    Start an inbound channel that replicates from server4.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_and_bootstrap_group_replication.inc

SET SESSION sql_log_bin= 0;
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.");
SET SESSION sql_log_bin= 1;

--let $debug_point= simulate_bgct_rpco_deadlock
--source include/add_debug_point.inc

--replace_result $SERVER_MYPORT_4 SERVER_4_PORT
--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'

--let $rpl_channel_name='ch1'
--source include/start_slave.inc
--let $rpl_channel_name=

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/start_group_replication.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/start_group_replication.inc


--echo
--echo ############################################################
--echo # 2. Schedule transactions in inbound replication channel
--let $rpl_connection_name= server4
--source include/rpl_connection.inc

CREATE TABLE t1 (c1 INT PRIMARY KEY, c2 LONGTEXT);

--disable_query_log
--let $j= 0
--let $k= 0
while ($j < 100)
{
  if ($k < 1) {
    --eval INSERT INTO t1 VALUES ($j, repeat('a', 6000000));
  }
  if ($k >= 1) {
    --eval INSERT INTO t1 VALUES ($j, 'a');
  }
  inc $j;
  inc $k;
  if ($k == 10)
  {
    --let $k= 0
  }
}
--enable_query_log

DROP TABLE t1;


--echo
--echo ############################################################
--echo # 3. There must be 0 applier threads on server1 with the state
--echo #    'Waiting for Binlog Group Commit ticket'.
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $wait_condition=SELECT COUNT(*)=0 FROM performance_schema.threads WHERE PROCESSLIST_STATE='Waiting for Binlog Group Commit ticket'
--source include/wait_condition.inc

--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_text = There were transactions that did commit out of order with respect to its source to follow the group global order
--let $assert_select = will commit out of order with respect to its source to follow the group global order
--let $assert_count_condition= >=1
--source include/assert_grep.inc


--echo
--echo ############################################################
--echo # 4. Clean up.
--let $rpl_connection_name= server4
--source include/rpl_connection.inc
--let $sync_slave_connection= server1
--source include/sync_slave_sql_with_master.inc

# sync all group members
--source include/rpl_sync.inc

--let $rpl_connection_name= server3
--source include/rpl_connection.inc
--source include/stop_group_replication.inc

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--source include/stop_group_replication.inc

--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--let $debug_point= simulate_bgct_rpco_deadlock
--source include/remove_debug_point.inc
--let $rpl_channel_name='ch1'
--source include/stop_slave.inc
--let $rpl_channel_name=
RESET REPLICA ALL FOR CHANNEL 'ch1';

--source include/stop_group_replication.inc

--source include/group_replication_end.inc