File: rpl_multi_source_channel_map_stress.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 (143 lines) | stat: -rw-r--r-- 5,562 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
# ==== Purpose ====
#
# This test will create two channels and will schedule many parallel
# replication administrative statements for each channel per second during
# a period of 10 seconds.
#
# After the testing period, the slave should be able to run replication
# administrative statements to stop and reset the two created channels
# without any contention.
#
# ==== Related Bugs and Worklogs ====
#
# BUG#20593028 MORE CONCURRENCY IN SHOW SLAVE STATUS: MAKE LOCK_MSR_MAP
#              AN RWLOCK
#

--source include/not_group_replication_plugin.inc
# This test case is binary log format agnostic
--source include/have_binlog_format_row.inc
# Test requires master-info-repository=TABLE, relay-log-info-repository=TABLE
--source include/have_slave_repository_type_table.inc
--source include/master-slave.inc

--source include/rpl_connection_slave.inc

CALL mtr.add_suppression('Replica failed to initialize connection metadata structure from the repository');
CALL mtr.add_suppression('This operation cannot be performed with a running replica');
CALL mtr.add_suppression('Could not find target log file mentioned in applier metadata in the index file');
# For case:
# STOP SLAVE SQL_THREAD; // IO_THREAD is running
# CHANGE MASTER TO relay_log_name = 'non-existing relay log name',...;
# While CHANGE MASTER throwns an error, group_relay_log_name is changed to the
# non-existing file name.
# START SLAVE SQL_THREAD; // It will log below error.
CALL mtr.add_suppression('Could not find relay log file');
CALL mtr.add_suppression('A replica with the same server_uuid/server_id as this replica has connected to the source');

# Save current event scheduler status
SET @saved_event_scheduler= @@GLOBAL.event_scheduler;
# relay_log_purge might be set to 0 by e_change_maste_sql_ch* below
SET @saved_relay_log_purge= @@GLOBAL.relay_log_purge;
SET @@GLOBAL.event_scheduler= OFF;

# Define the amount of channels to create
--let $num_channels= 2

# Stop slave for the default channel
--source include/stop_slave.inc

--let $c= 0
while ($c <= $num_channels)
{
  # The channel name
  --let $cn= 'ch$c'
  # The relay log suffix
  --let $rls= -ch$c
  if ($c == 0)
  {
    # For the default channel
    --let $cn= ''
    --let $rls=
  }
  --replace_result $MASTER_MYPORT SOURCE_PORT
  --eval CREATE EVENT e_change_master_io_ch$c  ON SCHEDULE EVERY 1 SECOND DO CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT FOR CHANNEL $cn
  --eval CREATE EVENT e_change_master_sql_ch$c ON SCHEDULE EVERY 1 SECOND DO CHANGE REPLICATION SOURCE TO RELAY_LOG_FILE='slave-relay-bin$rls.000001', RELAY_LOG_POS=4 FOR CHANNEL $cn
  --eval CREATE EVENT e_start_slave_io_ch$c    ON SCHEDULE EVERY 1 SECOND DO START SLAVE IO_THREAD FOR CHANNEL $cn
  --eval CREATE EVENT e_stop_slave_io_ch$c     ON SCHEDULE EVERY 1 SECOND DO STOP SLAVE IO_THREAD FOR CHANNEL $cn
  --eval CREATE EVENT e_reset_slave_ch$c       ON SCHEDULE EVERY 1 SECOND DO RESET SLAVE FOR CHANNEL $cn
  --eval CREATE EVENT e_reset_slave_all_ch$c   ON SCHEDULE EVERY 1 SECOND DO RESET SLAVE ALL FOR CHANNEL $cn
  --eval CREATE EVENT e_start_slave_sql_ch$c   ON SCHEDULE EVERY 1 SECOND DO START SLAVE SQL_THREAD FOR CHANNEL $cn
  --eval CREATE EVENT e_stop_slave_sql_ch$c    ON SCHEDULE EVERY 1 SECOND DO STOP SLAVE SQL_THREAD FOR CHANNEL $cn
  --eval CREATE EVENT e_sss_ch$c               ON SCHEDULE EVERY 1 SECOND DO SHOW SLAVE STATUS FOR CHANNEL $cn
  if ($c == 0)
  {
    --eval CREATE EVENT e_reset_master ON SCHEDULE EVERY 1 SECOND DO RESET MASTER
    --eval CREATE EVENT e_ils          ON SCHEDULE EVERY 1 SECOND DO SELECT * FROM performance_schema.log_status
  }
  --inc $c
}

# Let the game begin...
SET @@GLOBAL.event_scheduler= ON;

--echo Let the requests to run in parallel for 10 seconds
sleep 10;

#
# Test case cleanup
#
--let $c= $num_channels
while ($c >= 0)
{
  if ($c == 0)
  {
    --eval DROP EVENT e_ils
    --eval DROP EVENT e_reset_master
  }
  --eval DROP EVENT e_sss_ch$c
  --eval DROP EVENT e_stop_slave_sql_ch$c
  --eval DROP EVENT e_start_slave_sql_ch$c
  --eval DROP EVENT e_reset_slave_all_ch$c
  --eval DROP EVENT e_reset_slave_ch$c
  --eval DROP EVENT e_stop_slave_io_ch$c
  --eval DROP EVENT e_start_slave_io_ch$c
  --eval DROP EVENT e_change_master_sql_ch$c
  --eval DROP EVENT e_change_master_io_ch$c
  --dec $c
}

--let $scheduler_thread_id= `SELECT THREAD_ID FROM performance_schema.threads WHERE NAME = "thread/sql/event_scheduler"`
# Stop the scheduler
# If something bad happened, the test case should be stuck here
SET @@GLOBAL.event_scheduler= OFF;

--echo # Wait until all scheduler activity has finished
--let $wait_condition= SELECT COUNT(*) = 0 FROM performance_schema.threads WHERE PARENT_THREAD_ID=$scheduler_thread_id
--source include/wait_condition.inc

# Stop and remove all created channels
--disable_warnings
--let $c= $num_channels
while ($c > 0)
{
  --error 0, ER_REPLICA_CHANNEL_DOES_NOT_EXIST
  --eval STOP SLAVE FOR CHANNEL 'ch$c'
  --dec $c
}
STOP SLAVE FOR CHANNEL '';
RESET SLAVE ALL;
# Reconfigure the default channel
--replace_result $MASTER_MYPORT SOURCE_PORT
--eval CHANGE REPLICATION SOURCE TO SOURCE_USER='root', SOURCE_HOST='127.0.0.1', SOURCE_PORT=$MASTER_MYPORT
--enable_warnings

# Restore the scheduler and relay_log_purge
SET @@GLOBAL.event_scheduler = @saved_event_scheduler;
SET @@GLOBAL.relay_log_purge = @saved_relay_log_purge;

# To avoid problems in start_slave.inc and rpl_end.inc
--let $rpl_channel_name=
--let $_for_channel_clause=
--source include/start_slave.inc
--source include/rpl_end.inc