Commit db982ec8 authored by Manish Kumar's avatar Manish Kumar

BUG#12400221 - 60926: BINARY LOG EVENTS LARGER THAN MAX_ALLOWED_PACKET

Upmerge from mysql-5.1 -> mysql-5.5
parents d74c3df6 a9ca9403
......@@ -635,6 +635,9 @@ The following options may be given as the first argument:
--slave-load-tmpdir=name
The location where the slave should put its temporary
files when replicating a LOAD DATA INFILE command
--slave-max-allowed-packet=#
The maximum packet length to sent successfully from the
master to slave.
--slave-net-timeout=#
Number of seconds to wait for more data from a
master/slave connection before aborting the read
......@@ -930,6 +933,7 @@ skip-show-database FALSE
skip-slave-start FALSE
slave-compressed-protocol FALSE
slave-exec-mode STRICT
slave-max-allowed-packet 1073741824
slave-net-timeout 3600
slave-skip-errors (No default value)
slave-transaction-retries 10
......
......@@ -638,6 +638,9 @@ The following options may be given as the first argument:
--slave-load-tmpdir=name
The location where the slave should put its temporary
files when replicating a LOAD DATA INFILE command
--slave-max-allowed-packet=#
The maximum packet length to sent successfully from the
master to slave.
--slave-net-timeout=#
Number of seconds to wait for more data from a
master/slave connection before aborting the read
......@@ -940,6 +943,7 @@ skip-show-database FALSE
skip-slave-start FALSE
slave-compressed-protocol FALSE
slave-exec-mode STRICT
slave-max-allowed-packet 1073741824
slave-net-timeout 3600
slave-skip-errors (No default value)
slave-transaction-retries 10
......
......@@ -9,7 +9,7 @@ change master to master_log_pos=MASTER_LOG_POS;
Read_Master_Log_Pos = '75'
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the first event 'master-bin.000001' at XXX, the last event read from './master-bin.000001' at XXX, the last byte read from './master-bin.000001' at XXX.''
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the first event 'master-bin.000001' at XXX, the last event read from './master-bin.000001' at XXX, the last byte read from './master-bin.000001' at XXX.''
include/stop_slave_sql.inc
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
......
include/master-slave.inc
[connection master]
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, Error_code: 1153");
call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
drop database if exists DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
create database DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
SET @@global.max_allowed_packet=1024;
......@@ -30,14 +30,14 @@ include/start_slave.inc
CREATE TABLE `t1` (`f1` LONGTEXT) ENGINE=MyISAM;
INSERT INTO `t1`(`f1`) VALUES ('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2048');
include/wait_for_slave_io_error.inc [errno=1153]
Last_IO_Error = 'Got a packet bigger than 'max_allowed_packet' bytes'
Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes'
include/stop_slave_sql.inc
include/rpl_reset.inc
DROP TABLE t1;
CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the first event '' at XXX, the last event read from './master-bin.000001' at XXX, the last byte read from './master-bin.000001' at XXX.''
include/wait_for_slave_io_error.inc [errno=1153]
Last_IO_Error = 'Got a packet bigger than 'slave_max_allowed_packet' bytes'
STOP SLAVE;
RESET SLAVE;
RESET MASTER;
......@@ -52,6 +52,7 @@ SET @@global.max_allowed_packet= 1024;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET @@global.net_buffer_length= 1024;
SET @@global.slave_max_allowed_packet= 1073741824;
DROP TABLE t1;
RESET SLAVE;
include/rpl_end.inc
--max_allowed_packet=1024 --net_buffer_length=1024
--max_allowed_packet=1024 --net_buffer_length=1024 --slave_max_allowed_packet=1024
......@@ -11,9 +11,8 @@
# max-out size db name
source include/master-slave.inc;
source include/have_binlog_format_row.inc;
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'max_allowed_packet' bytes, Error_code: 1153");
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log:");
call mtr.add_suppression("Slave I/O: Got a packet bigger than 'slave_max_allowed_packet' bytes, Error_code: 1153");
call mtr.add_suppression("Log entry on master is longer than slave_max_allowed_packet");
let $db= DB_NAME_OF_MAX_LENGTH_AKA_NAME_LEN_64_BYTES_____________________;
disable_warnings;
eval drop database if exists $db;
......@@ -23,6 +22,7 @@ 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_slave_max_allowed_packet= `SELECT @@global.slave_max_allowed_packet`;
SET @@global.max_allowed_packet=1024;
SET @@global.net_buffer_length=1024;
......@@ -123,11 +123,9 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), R
connection slave;
# The slave I/O thread must stop after receiving
# 1236=ER_MASTER_FATAL_ERROR_READING_BINLOG error message from master.
--let $slave_io_errno= 1236
# Mask line numbers
--let $slave_io_error_replace= / at [0-9]*/ at XXX/
# 1153 = ER_NET_PACKET_TOO_LARGE
--let $slave_io_errno= 1153
--let $show_slave_io_error= 1
--source include/wait_for_slave_io_error.inc
# Remove the bad binlog and clear error status on slave.
......@@ -167,6 +165,7 @@ 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.slave_max_allowed_packet= $old_slave_max_allowed_packet;
# slave is stopped
connection slave;
DROP TABLE t1;
......
SET @start_value = @@global.slave_max_allowed_packet;
SELECT @start_value;
@start_value
1073741824
'#--------------------FN_DYNVARS_072_01------------------------#'
SET @@global.slave_max_allowed_packet = 5000;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '5000'
SET @@global.slave_max_allowed_packet = DEFAULT;
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1073741824
'#---------------------FN_DYNVARS_072_02-------------------------#'
SET @@global.slave_max_allowed_packet = @start_value;
SELECT @@global.slave_max_allowed_packet = 1073741824;
@@global.slave_max_allowed_packet = 1073741824
1
'Bug# 34876: Incorrect Default Value is assigned to variable';
'#--------------------FN_DYNVARS_072_03------------------------#'
SET @@global.slave_max_allowed_packet = 1024;
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
SET @@global.slave_max_allowed_packet = 1073741824;
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1073741824
SET @@global.slave_max_allowed_packet = 1073741824;
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1073741824
SET @@global.slave_max_allowed_packet = 1025;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1025'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
SET @@global.slave_max_allowed_packet = 65535;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '65535'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
64512
'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
'#--------------------FN_DYNVARS_072_04-------------------------#'
SET @@global.slave_max_allowed_packet = -1;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '-1'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
SET @@global.slave_max_allowed_packet = 100000000000;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '100000000000'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1073741824
SET @@global.slave_max_allowed_packet = 10000.01;
ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1073741824
SET @@global.slave_max_allowed_packet = -1024;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '-1024'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
SET @@global.slave_max_allowed_packet = 4294967296;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '4294967296'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1073741824
SET @@global.slave_max_allowed_packet = 1023;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1023'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
'Bug # 34837: Errors are not coming on assigning invalid values to variable';
SET @@global.slave_max_allowed_packet = ON;
ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
SET @@global.slave_max_allowed_packet = 'test';
ERROR 42000: Incorrect argument type to variable 'slave_max_allowed_packet'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
'#-------------------FN_DYNVARS_072_05----------------------------#'
SET @@session.slave_max_allowed_packet = 4096;
ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@session.slave_max_allowed_packet;
ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable
'#----------------------FN_DYNVARS_072_06------------------------#'
SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slave_max_allowed_packet';
@@global.slave_max_allowed_packet = VARIABLE_VALUE
1
SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='slave_max_allowed_packet';
@@slave_max_allowed_packet = VARIABLE_VALUE
1
'#---------------------FN_DYNVARS_072_07----------------------#'
SET @@global.slave_max_allowed_packet = TRUE;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '1'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
SET @@global.slave_max_allowed_packet = FALSE;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '0'
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1024
'#---------------------FN_DYNVARS_072_08----------------------#'
SET @@global.slave_max_allowed_packet = 5000;
Warnings:
Warning 1292 Truncated incorrect slave_max_allowed_packet value: '5000'
SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
@@slave_max_allowed_packet = @@global.slave_max_allowed_packet
1
'#---------------------FN_DYNVARS_072_09----------------------#'
SET slave_max_allowed_packet = 6000;
ERROR HY000: Variable 'slave_max_allowed_packet' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@slave_max_allowed_packet;
@@slave_max_allowed_packet
4096
SET local.slave_max_allowed_packet = 7000;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'slave_max_allowed_packet = 7000' at line 1
SELECT local.slave_max_allowed_packet;
ERROR 42S02: Unknown table 'local' in field list
SET global.slave_max_allowed_packet = 8000;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'slave_max_allowed_packet = 8000' at line 1
SELECT global.slave_max_allowed_packet;
ERROR 42S02: Unknown table 'global' in field list
SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
ERROR 42S22: Unknown column 'slave_max_allowed_packet' in 'field list'
SET @@global.slave_max_allowed_packet = @start_value;
SELECT @@global.slave_max_allowed_packet;
@@global.slave_max_allowed_packet
1073741824
############## mysql-test\t\slave_max_allowed_packet_basic.test ##################
# #
# Variable Name: slave_max_allowed_packet #
# Scope: GLOBAL #
# Access Type: Dynamic #
# Data Type: numeric #
# Default Value:1073741824 #
# Range: 1024 - 1073741824 #
# #
# #
# #
# Description: Test Cases of Dynamic System Variable slave_max_allowed_packet #
# that checks the behavior of this variable in the following ways#
# * Default Value #
# * Valid & Invalid values #
# * Scope & Access method #
# * Data Integrity #
# #
###############################################################################
--source include/load_sysvars.inc
########################################################################
# START OF slave_max_allowed_packet TESTS #
########################################################################
###########################################################################
# Saving initial value of slave_max_allowed_packet in a temporary variable#
###########################################################################
SET @start_value = @@global.slave_max_allowed_packet;
SELECT @start_value;
--echo '#--------------------FN_DYNVARS_072_01------------------------#'
########################################################################
# Display the DEFAULT value of slave_max_allowed_packet #
########################################################################
SET @@global.slave_max_allowed_packet = 5000;
SET @@global.slave_max_allowed_packet = DEFAULT;
SELECT @@global.slave_max_allowed_packet;
--echo '#---------------------FN_DYNVARS_072_02-------------------------#'
###############################################
# Verify default value of variable #
###############################################
SET @@global.slave_max_allowed_packet = @start_value;
SELECT @@global.slave_max_allowed_packet = 1073741824;
--echo 'Bug# 34876: Incorrect Default Value is assigned to variable';
--echo '#--------------------FN_DYNVARS_072_03------------------------#'
########################################################################
# Change the value of slave_max_allowed_packet to a valid value #
########################################################################
SET @@global.slave_max_allowed_packet = 1024;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = 1073741824;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = 1073741824;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = 1025;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = 65535;
SELECT @@global.slave_max_allowed_packet;
--echo 'Bug# 34877: Invalid Values are coming in variable on assigning valid values';
--echo '#--------------------FN_DYNVARS_072_04-------------------------#'
###########################################################################
# Change the value of slave_max_allowed_packet to invalid value #
###########################################################################
SET @@global.slave_max_allowed_packet = -1;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = 100000000000;
SELECT @@global.slave_max_allowed_packet;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.slave_max_allowed_packet = 10000.01;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = -1024;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = 4294967296;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = 1023;
SELECT @@global.slave_max_allowed_packet;
--echo 'Bug # 34837: Errors are not coming on assigning invalid values to variable';
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.slave_max_allowed_packet = ON;
SELECT @@global.slave_max_allowed_packet;
--Error ER_WRONG_TYPE_FOR_VAR
SET @@global.slave_max_allowed_packet = 'test';
SELECT @@global.slave_max_allowed_packet;
--echo '#-------------------FN_DYNVARS_072_05----------------------------#'
###########################################################################
# Test if accessing session slave_max_allowed_packet gives error #
###########################################################################
--Error ER_GLOBAL_VARIABLE
SET @@session.slave_max_allowed_packet = 4096;
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
SELECT @@session.slave_max_allowed_packet;
--echo '#----------------------FN_DYNVARS_072_06------------------------#'
##############################################################################
# Check if the value in GLOBAL & SESSION Tables matches values in variable #
##############################################################################
SELECT @@global.slave_max_allowed_packet = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slave_max_allowed_packet';
SELECT @@slave_max_allowed_packet = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='slave_max_allowed_packet';
--echo '#---------------------FN_DYNVARS_072_07----------------------#'
###################################################################
# Check if TRUE and FALSE values can be used on variable #
###################################################################
SET @@global.slave_max_allowed_packet = TRUE;
SELECT @@global.slave_max_allowed_packet;
SET @@global.slave_max_allowed_packet = FALSE;
SELECT @@global.slave_max_allowed_packet;
--echo '#---------------------FN_DYNVARS_072_08----------------------#'
########################################################################################################
# Check if accessing variable with SESSION,LOCAL and without SCOPE points to same session variable #
########################################################################################################
SET @@global.slave_max_allowed_packet = 5000;
SELECT @@slave_max_allowed_packet = @@global.slave_max_allowed_packet;
--echo '#---------------------FN_DYNVARS_072_09----------------------#'
################################################################################
# Check if slave_max_allowed_packet can be accessed with and without @@ sign #
################################################################################
--Error ER_GLOBAL_VARIABLE
SET slave_max_allowed_packet = 6000;
SELECT @@slave_max_allowed_packet;
--Error ER_PARSE_ERROR
SET local.slave_max_allowed_packet = 7000;
--Error ER_UNKNOWN_TABLE
SELECT local.slave_max_allowed_packet;
--Error ER_PARSE_ERROR
SET global.slave_max_allowed_packet = 8000;
--Error ER_UNKNOWN_TABLE
SELECT global.slave_max_allowed_packet;
--Error ER_BAD_FIELD_ERROR
SELECT slave_max_allowed_packet = @@session.slave_max_allowed_packet;
##############################
# Restore initial value #
##############################
SET @@global.slave_max_allowed_packet = @start_value;
SELECT @@global.slave_max_allowed_packet;
########################################################################
# END OF slave_max_allowed_packet TESTS #
########################################################################
......@@ -1139,7 +1139,7 @@ failed my_b_read"));
Log_event *res= 0;
#ifndef max_allowed_packet
THD *thd=current_thd;
uint max_allowed_packet= thd ? thd->variables.max_allowed_packet : ~(ulong)0;
uint max_allowed_packet= thd ? slave_max_allowed_packet:~(ulong)0;
#endif
if (data_len > max_allowed_packet)
......
......@@ -280,6 +280,13 @@ struct sql_ex_info
MAX_SIZE_LOG_EVENT_STATUS + /* status */ \
NAME_LEN + 1)
/*
The new option is added to handle large packets that are sent from the master
to the slave. It is used to increase the thd(max_allowed) for both the
DUMP thread on the master and the SQL/IO thread on the slave.
*/
#define MAX_MAX_ALLOWED_PACKET 1024*1024*1024
/*
Event header offsets;
these point to places inside the fixed header.
......
......@@ -469,6 +469,7 @@ ulonglong slave_type_conversions_options;
ulong thread_cache_size=0;
ulong binlog_cache_size=0;
ulonglong max_binlog_cache_size=0;
ulong slave_max_allowed_packet= 0;
ulong binlog_stmt_cache_size=0;
ulonglong max_binlog_stmt_cache_size=0;
ulong query_cache_size=0;
......
......@@ -179,6 +179,7 @@ extern ulong open_files_limit;
extern ulong binlog_cache_size, binlog_stmt_cache_size;
extern ulonglong max_binlog_cache_size, max_binlog_stmt_cache_size;
extern ulong max_binlog_size, max_relay_log_size;
extern ulong slave_max_allowed_packet;
extern ulong opt_binlog_rows_event_max_size;
extern ulong rpl_recovery_rank, thread_cache_size;
extern ulong stored_program_cache_size;
......
......@@ -2077,8 +2077,7 @@ static int init_slave_thread(THD* thd, SLAVE_THD_TYPE thd_type)
slave threads, since a replication event can become this much larger
than the corresponding packet (query) sent from client to master.
*/
thd->variables.max_allowed_packet= global_system_variables.max_allowed_packet
+ MAX_LOG_EVENT_HEADER; /* note, incr over the global not session var */
thd->variables.max_allowed_packet= slave_max_allowed_packet;
thd->slave_thread = 1;
thd->enable_slow_log= opt_log_slow_slave_statements;
set_slave_thread_options(thd);
......@@ -2834,6 +2833,7 @@ pthread_handler_t handle_slave_io(void *arg)
thread, since a replication event can become this much larger than
the corresponding packet (query) sent from client to master.
*/
thd->net.max_packet_size= slave_max_allowed_packet;
mysql->net.max_packet_size= thd->net.max_packet_size+= MAX_LOG_EVENT_HEADER;
}
else
......@@ -2966,12 +2966,12 @@ reading event"))
switch (mysql_error_number) {
case CR_NET_PACKET_TOO_LARGE:
sql_print_error("\
Log entry on master is longer than max_allowed_packet (%ld) on \
Log entry on master is longer than slave_max_allowed_packet (%lu) on \
slave. If the entry is correct, restart the server with a higher value of \
max_allowed_packet",
thd->variables.max_allowed_packet);
slave_max_allowed_packet",
slave_max_allowed_packet);
mi->report(ERROR_LEVEL, ER_NET_PACKET_TOO_LARGE,
"%s", ER(ER_NET_PACKET_TOO_LARGE));
"%s", "Got a packet bigger than 'slave_max_allowed_packet' bytes");
goto err;
case ER_MASTER_FATAL_ERROR_READING_BINLOG:
mi->report(ERROR_LEVEL, ER_MASTER_FATAL_ERROR_READING_BINLOG,
......
......@@ -588,7 +588,7 @@ impossible position";
this larger than the corresponding packet (query) sent
from client to master.
*/
thd->variables.max_allowed_packet+= MAX_LOG_EVENT_HEADER;
thd->variables.max_allowed_packet= MAX_MAX_ALLOWED_PACKET;
/*
We can set log_lock now, it does not move (it's a member of
......
......@@ -45,6 +45,7 @@
#include "derror.h" // read_texts
#include "sql_base.h" // close_cached_tables
#include "log_event.h"
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
......@@ -1131,6 +1132,14 @@ static Sys_var_ulong Sys_max_allowed_packet(
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(check_max_allowed_packet));
static Sys_var_ulong Sys_slave_max_allowed_packet(
"slave_max_allowed_packet",
"The maximum packet length to sent successfully from the master to slave.",
GLOBAL_VAR(slave_max_allowed_packet), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, MAX_MAX_ALLOWED_PACKET),
DEFAULT(MAX_MAX_ALLOWED_PACKET),
BLOCK_SIZE(1024));
static Sys_var_ulonglong Sys_max_binlog_cache_size(
"max_binlog_cache_size",
"Sets the total size of the transactional cache",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment