File: rpl_multi_source_slave_skip_counter.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 (121 lines) | stat: -rw-r--r-- 3,828 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
# WL#1697: Multisource replication
#
# Test the behaviour when sql_replica_skip_counter is set
#
# BUG#19634753: WL1697: IF SQL_REPLICA_SKIP_COUNTER > 0, IO_THREAD(S) ARE
#               NOT ABLE TO START
# BUG#20400518
# The behavior for MySQL 5.7 should be:
#
# sql_replica_skip_counter can be set at anytime, even some channels are running.
# Setting sql_replica_skip_counter doesn't effect any running channel. Its value
# only effects the first channel starting after the
# 'SET GLOBAL sql_replica_skip_counter'. After the channel starts,
# sql_replica_skip_counter will be reset to 0 automatically.
#
# The process like:
#
# SET GLOBAL sql_replica_skip_counter = 5;
# START SLAVE FOR CHANNEL 'ch1';
#
# SHOW SLAVE STATUS FOR CHANNEL 'channel_1';
# Skip_count item will be 5.
#
# SELECT @@GLOBAL.sql_replica_skip_counter;
# It will be 0.
#
#
# START SLAVE will report the error ER_REPLICA_CHANNEL_SQL_SKIP_COUNTER if it is
# starting more than one channels.
#
#
#Skip on group replication runs
--source include/not_group_replication_plugin.inc
--source include/have_binlog_format_mixed.inc
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
--source include/have_slave_repository_type_table.inc

--echo #
--echo # set up masters server_1 and server_3 with server_2 being a slave.
--echo #.
--let $rpl_multi_source= 1
--let $rpl_topology= 1->2,3->2
--source include/rpl_init.inc

# On slave
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
call mtr.add_suppression("Replica: Could not start replica for channel");

--echo #
--echo # Verify that Setting sql_replica_skip_counter doesn't effect running
--echo # channels
--echo #
SET GLOBAL sql_replica_skip_counter= 1;

--let $skip_counter= query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'channel_1', Skip_Counter, 1)
--let $assert_text= check that channel_1's Skip_Counter is 0.
--echo $skip_counter
--let $assert_cond= $skip_counter=0
--source include/assert.inc

# stop SQL THREAD for all channels
STOP SLAVE SQL_THREAD;
--let $rpl_source_file= include/wait_for_slave_sql_to_stop.inc
--source include/rpl_for_each_connection.inc

--echo #
--echo # Verify that START SLAVE FOR CHANNEL will copy sql_replica_skip_counter's
--echo # value to the channel and reset sql_replica_skip_counter to 0
--echo #

# first stop the channels
--let $rpl_connection_name= server_2
--source include/rpl_connection.inc
--source include/stop_slave.inc

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

--let $skip_counter= query_get_value(SHOW SLAVE STATUS FOR CHANNEL 'channel_1', Skip_Counter, 1)
--let $assert_text= check that channel_1's Skip_Counter is 0.
--echo $skip_counter
--let $assert_cond= $skip_counter= 1
--source include/assert.inc

--let $assert_text= check that sql_replica_skip_counter is 0
--let $assert_cond= @@GLOBAL.sql_replica_skip_counter = 0
--source include/assert.inc

--echo #
--echo # START SLAVE [SQL_THREAD] will fail when sql_replica_skip_counter is 1
--echo # and there are more than one channels
--echo #
SET GLOBAL sql_replica_skip_counter = 1;

--error ER_REPLICA_CHANNEL_SQL_SKIP_COUNTER
START SLAVE;

--error ER_REPLICA_CHANNEL_SQL_SKIP_COUNTER
START SLAVE SQL_THREAD;

--echo #
--echo # START SLAVE IO_THREAD should not fail.
--echo #

--disable_warnings
START SLAVE IO_THREAD;
--enable_warnings
--let $rpl_source_file= include/wait_for_slave_io_to_start.inc
--source include/rpl_for_each_connection.inc

--let $assert_text= All two IO threads are running after START SLAVE IO_THREAD
--let $assert_cond= [SELECT COUNT(*) FROM performance_schema.replication_connection_status WHERE Service_State="ON"] = 2;
--source include/assert.inc

SET GLOBAL sql_replica_skip_counter= 0;

# End MSR setup.
--let $rpl_skip_sync= 1
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc