File: rpl_packet.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 (303 lines) | stat: -rw-r--r-- 11,835 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# ==== Purpose ====
#
# Check replication protocol packet size handling
#
# ==== Related bugs ====
# Bug#19402 SQL close to the size of the max_allowed_packet fails on slave
# BUG#23755: Replicated event larger that max_allowed_packet infinitely re-transmits
# BUG#42914: No LAST_IO_ERROR for max_allowed_packet errors
# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET

--source include/force_myisam_default.inc
--source include/have_myisam.inc
# max-out size db name 
--source include/not_group_replication_plugin.inc
source include/have_binlog_format_row.inc;

source include/master-slave.inc;

call mtr.add_suppression("Replica I/O for channel '': Got a packet bigger than 'replica_max_allowed_packet' bytes, Error_code: MY-013125");
call mtr.add_suppression("Log entry on source is longer than replica_max_allowed_packet");
let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
disable_warnings;
eval drop database if exists $db;
enable_warnings;
eval create database $db;

connection master;
let $old_max_allowed_packet= `SELECT @@global.max_allowed_packet`;
let $old_net_buffer_length= `SELECT @@global.net_buffer_length`;
let $old_replica_max_allowed_packet= `SELECT @@global.replica_max_allowed_packet`;
let $old_replica_max_allowed_packet_temp= `SELECT @@global.replica_max_allowed_packet`;
SET @@global.max_allowed_packet=10240;
SET @@global.net_buffer_length=1024;

--source include/sync_slave_sql_with_master.inc
# Restart slave for setting to take effect
call mtr.add_suppression(".*The replica coordinator and worker threads are stopped, possibly leaving data in inconsistent state.*");
source include/stop_slave.inc;
source include/start_slave.inc;

# Reconnect to master for new setting to take effect
disconnect master;

# alas, can't use eval here; if db name changed apply the change here
connect (master,localhost,root,,DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________);

connection master;
select @@net_buffer_length, @@max_allowed_packet;

create table `t1` (`f1` LONGTEXT);

INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
--source include/sync_slave_sql_with_master.inc

eval select count(*) from `$db`.`t1` /* must be 1 */;

--disable_warnings
select ras.SERVICE_STATE as Slave_SQL_Running, rcs.SERVICE_STATE as Slave_IO_Running 
from performance_schema.replication_applier_status ras, 
performance_schema.replication_connection_status rcs;
--enable_warnings
connection master;
eval drop database $db;
--source include/sync_slave_sql_with_master.inc

#
# Bug #23755: Replicated event larger that max_allowed_packet infinitely re-transmits
#
# Check that a situation when the size of event on the master is greater than 
# max_allowed_packet on the slave does not lead to infinite re-transmits.

connection master;

# Change the max packet size on master

# Todo: improve over-max_allowed_packet size events block on the slave.
# The current size checking algorithm is not presize to allow large event
# to slip it. Reject happens according to the guard:
#   if (data_len > max(max_allowed_packet,
#       opt_binlog_rows_event_max_size + MAX_LOG_EVENT_HEADER))
# However, MAX_LOG_EVENT_HEADER is a conservative estimate so if the actual
# header size is less the extra data let in the slave.

# Adding the max size of the query log event status as
# MAX_DBS_IN_QUERY_MTS * (1 + NAME_LEN) to make the master not fail to read
# an event itself. The increased max_allowed_packet also takes care of the 
# increase in the connect string processing introduced due to WL#5924.

SET @@global.max_allowed_packet=4096 + (floor(64 * 3 * 254 / 1024) + 1) * 1024;
SET @@global.net_buffer_length=@@global.max_allowed_packet;

# Restart slave for new setting to take effect
connection slave;
source include/stop_slave.inc;
source include/start_slave.inc;

# Reconnect to master for new setting to take effect
disconnect master;
connect (master, localhost, root);
connection master;

CREATE TABLE `t1` (`f1` LONGTEXT);

--source include/sync_slave_sql_with_master.inc
--source include/stop_slave_sql.inc

connection master;

INSERT INTO t1 VALUES (REPEAT('a', @@global.max_allowed_packet));


#
# Bug#42914: The slave I/O thread must stop after trying to read the above
# event, However there is no Last_IO_Error report.
#

# The slave I/O thread must stop after trying to read the above event
connection slave;
# 13125 = ER_SERVER_NET_PACKET_TOO_LARGE
--let $slave_io_errno= 13125
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc

#
# Bug#42914: On the master, if a binary log event is larger than
# max_allowed_packet, the error message ER_SOURCE_FATAL_ERROR_READING_BINLOG
# is sent to a slave when it requests a dump from the master, thus leading the
# I/O thread to stop. However, there is no Last_IO_Error reported.
#

--let $rpl_only_running_threads= 1
--source include/rpl_reset.inc
--connection master
DROP TABLE t1;
--source include/sync_slave_sql_with_master.inc


connection master;
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
--source include/sync_slave_sql_with_master.inc

connection master;
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));

connection slave;
# The slave I/O thread must stop after receiving
# 13125 = ER_SERVER_NET_PACKET_TOO_LARGE
--let $slave_io_errno= 13125
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc

# Remove the bad binlog and clear error status on slave.
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
--connection master
RESET MASTER;


#
# BUG#55322: SHOW BINLOG EVENTS increases @@SESSION.MAX_ALLOWED_PACKET
#
# In BUG#55322, @@session.max_allowed_packet increased each time SHOW
# BINLOG EVENTS was issued. To verify that this bug is fixed, we
# execute SHOW BINLOG EVENTS twice and check that max_allowed_packet
# never changes.  We turn off the result log because we don't care
# about the contents of the binlog.

--disable_result_log
SET @max_allowed_packet_0= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_1= @@session.max_allowed_packet;
SHOW BINLOG EVENTS;
SET @max_allowed_packet_2= @@session.max_allowed_packet;
--enable_result_log
if (`SELECT NOT(@max_allowed_packet_0 = @max_allowed_packet_1 AND @max_allowed_packet_1 = @max_allowed_packet_2)`)
{
  --echo ERROR: max_allowed_packet changed after executing SHOW BINLOG EVENTS
  --source include/show_rpl_debug_info.inc
  SELECT @max_allowed_packet_0, @max_allowed_packet_1, @max_allowed_packet_2;
  --die @max_allowed_packet changed after executing SHOW BINLOG EVENTS
}

#
# BUG#55790
# This test verifies if the header of Table_map_log_event
# will be displayed by MYSQLBINLOG so long as it was written
# to the relay log, even if its rows events are discarded.
# And MYSQLBINLOG will print a warning for the missed
# rows event.
#

connection slave;

START SLAVE;
--source include/wait_for_slave_to_start.inc

connection master;
DROP TABLE t1;
select @@global.max_allowed_packet;
select @@global.net_buffer_length;
--source include/sync_slave_sql_with_master.inc
select @@global.max_allowed_packet;
select @@global.net_buffer_length;

--connection master
CREATE TABLE t1 (a TEXT) ENGINE=MyISAM;
--source include/sync_slave_sql_with_master.inc

# Create big row event.
--connection master
INSERT INTO t1 VALUES (REPEAT('a', @@global.max_allowed_packet));

# Slave IO thread should stop with error when trying to read the big event.
--connection slave
--echo # 13125 = ER_SERVER_NET_PACKET_TOO_LARGE
--let $slave_io_errno= 13125
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc

--echo # Record Read_Master_Log_Pos for the Table_map_log_event
--let $table_map_log_pos= query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1)

--let $MYSQLD_DATADIR= `SELECT @@datadir`
--let $start_pos= query_get_value("SHOW SLAVE STATUS", Relay_Log_Pos, 1)
--let $relay_log_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
--let $outfile= $MYSQLTEST_VARDIR/tmp/b55790-mysqlbinlog
--let $i= 2

--let $old_replica_max_allowed_packet= `SELECT @@global.max_allowed_packet`
SET @@global.max_allowed_packet=1048576;
# Restart slave session for new settings to take effect.
--connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT,)
--connection slave2

while($i)
{
  --let $flags=--start-position=$start_pos

  if($i==2)
  {
    --let $flags= $flags --base64-output=decode-rows -v
  }

  --exec $MYSQL_BINLOG $flags $MYSQLD_DATADIR/$relay_log_file 1> $outfile.1 2> $outfile.2
  -- let POS=$table_map_log_pos
  -- let FLGS=$flags
  -- let OUTFILE_1=$outfile.1

  -- perl
$found=0;
$file= $ENV{'OUTFILE_1'};
$table_map_log_pos= $ENV{'POS'};
$flags= $ENV{'FLGS'};

open(FILE, "$file") or die("Unable to open $file: $!\n");
while(<FILE>) {
  if (/end_log_pos $table_map_log_pos .*Table_map/) {
    $found=1;
    break;
  }
}

if (!$found)
{
  print "**** ERROR **** Table map 'end_log_pos $table_map_log_pos  Table_map' NOT FOUND in mysqlbinlog output ($flags $file).";
  seek(FILE, 0, 0);
  while($line= <FILE>) {
    print $line;
  }
}
close(FILE);
EOF

  # Check the warning is caused
  --cat_file $outfile.2

  # Remove unecessary files
  --remove_file $outfile.1
  --remove_file $outfile.2

  --dec $i
}

--echo ==== clean up ====
connection master;
DROP TABLE t1;
eval SET @@global.max_allowed_packet= $old_max_allowed_packet;
eval SET @@global.net_buffer_length= $old_net_buffer_length;
eval SET @@global.replica_max_allowed_packet= $old_replica_max_allowed_packet_temp;
# slave is stopped
connection slave;
eval SET @@global.max_allowed_packet= $old_replica_max_allowed_packet;
DROP TABLE t1;

# Clear Last_IO_Error

STOP REPLICA;
RESET SLAVE;

--let $rpl_only_running_threads=1
--source include/rpl_end.inc
# End of tests