Commit 0d01bcca authored by Georgi Kodinov's avatar Georgi Kodinov

Merged bug #11766769 to 5.5.

Added back the specific warning number.
parents 11ca6e2c dcf6b68d
...@@ -3,6 +3,7 @@ set @net_buffer_length=@@global.net_buffer_length; ...@@ -3,6 +3,7 @@ set @net_buffer_length=@@global.net_buffer_length;
set global max_allowed_packet=100; set global max_allowed_packet=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100' Warning 1292 Truncated incorrect max_allowed_packet value: '100'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global net_buffer_length=100; set global net_buffer_length=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect net_buffer_length value: '100' Warning 1292 Truncated incorrect net_buffer_length value: '100'
......
...@@ -505,6 +505,7 @@ set low_priority_updates=1; ...@@ -505,6 +505,7 @@ set low_priority_updates=1;
set global max_allowed_packet=100; set global max_allowed_packet=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '100' Warning 1292 Truncated incorrect max_allowed_packet value: '100'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global max_binlog_cache_size=100; set global max_binlog_cache_size=100;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_binlog_cache_size value: '100' Warning 1292 Truncated incorrect max_binlog_cache_size value: '100'
...@@ -1059,6 +1060,8 @@ set global max_write_lock_count =default; ...@@ -1059,6 +1060,8 @@ set global max_write_lock_count =default;
set global myisam_data_pointer_size =@my_myisam_data_pointer_size; set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size; set global myisam_max_sort_file_size =@my_myisam_max_sort_file_size;
set global net_buffer_length =@my_net_buffer_length; set global net_buffer_length =@my_net_buffer_length;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
set global net_write_timeout =@my_net_write_timeout; set global net_write_timeout =@my_net_write_timeout;
set global net_read_timeout =@my_net_read_timeout; set global net_read_timeout =@my_net_read_timeout;
set global query_cache_limit =@my_query_cache_limit; set global query_cache_limit =@my_query_cache_limit;
...@@ -1547,6 +1550,30 @@ SET @@global.max_binlog_cache_size=DEFAULT; ...@@ -1547,6 +1550,30 @@ SET @@global.max_binlog_cache_size=DEFAULT;
SET @@global.max_join_size=DEFAULT; SET @@global.max_join_size=DEFAULT;
SET @@global.key_buffer_size=@kbs; SET @@global.key_buffer_size=@kbs;
SET @@global.key_cache_block_size=@kcbs; SET @@global.key_cache_block_size=@kcbs;
#
# Bug #11766769 : 59959: SMALL VALUES OF --MAX-ALLOWED-PACKET
# ARE NOT BEING HONORED
#
CREATE TABLE t1 (a MEDIUMTEXT);
SET GLOBAL max_allowed_packet=2048;
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=4096;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SHOW SESSION VARIABLES LIKE 'max_allowed_packet';
Variable_name Value
max_allowed_packet 2048
SHOW SESSION VARIABLES LIKE 'net_buffer_length';
Variable_name Value
net_buffer_length 4096
ERROR 08S01: Got a packet bigger than 'max_allowed_packet' bytes
at this point the connection is disconnected by the server
SELECT LENGTH(a) FROM t1;
LENGTH(a)
SET GLOBAL max_allowed_packet=default;
SET GLOBAL net_buffer_length=default;
DROP TABLE t1;
End of 5.1 tests End of 5.1 tests
# #
......
...@@ -49,6 +49,8 @@ SET @max_allowed_packet_2= @@session.max_allowed_packet; ...@@ -49,6 +49,8 @@ SET @max_allowed_packet_2= @@session.max_allowed_packet;
==== clean up ==== ==== clean up ====
DROP TABLE t1; DROP TABLE t1;
SET @@global.max_allowed_packet= 1024; 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.net_buffer_length= 1024;
DROP TABLE t1; DROP TABLE t1;
RESET SLAVE; RESET SLAVE;
......
--read_buffer_size=12K --max_allowed_packet=8K --read_buffer_size=12K --max_allowed_packet=8K --net-buffer-length=8K
--max_allowed_packet=8K --max_allowed_packet=8K --net-buffer-length=8K
...@@ -7,6 +7,7 @@ SET @@global.max_allowed_packet = DEFAULT; ...@@ -7,6 +7,7 @@ SET @@global.max_allowed_packet = DEFAULT;
SET @@global.max_allowed_packet = 1000; SET @@global.max_allowed_packet = 1000;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1000' Warning 1292 Truncated incorrect max_allowed_packet value: '1000'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SET @@global.max_allowed_packet = DEFAULT; SET @@global.max_allowed_packet = DEFAULT;
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
...@@ -25,12 +26,15 @@ SELECT @@global.max_allowed_packet = 1048576; ...@@ -25,12 +26,15 @@ SELECT @@global.max_allowed_packet = 1048576;
1 1
'#--------------------FN_DYNVARS_070_03-------------------------#' '#--------------------FN_DYNVARS_070_03-------------------------#'
SET @@global.max_allowed_packet = 1024; 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'
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1024 1024
SET @@global.max_allowed_packet = 1025; SET @@global.max_allowed_packet = 1025;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1025' Warning 1292 Truncated incorrect max_allowed_packet value: '1025'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1024 1024
...@@ -74,18 +78,21 @@ SELECT @@session.max_allowed_packet; ...@@ -74,18 +78,21 @@ SELECT @@session.max_allowed_packet;
SET @@global.max_allowed_packet = 0; SET @@global.max_allowed_packet = 0;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '0' Warning 1292 Truncated incorrect max_allowed_packet value: '0'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1024 1024
SET @@global.max_allowed_packet = -1024; SET @@global.max_allowed_packet = -1024;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '-1024' Warning 1292 Truncated incorrect max_allowed_packet value: '-1024'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1024 1024
SET @@global.max_allowed_packet = 1023; SET @@global.max_allowed_packet = 1023;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1023' Warning 1292 Truncated incorrect max_allowed_packet value: '1023'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1024 1024
...@@ -148,17 +155,21 @@ WHERE VARIABLE_NAME='max_allowed_packet'; ...@@ -148,17 +155,21 @@ WHERE VARIABLE_NAME='max_allowed_packet';
SET @@global.max_allowed_packet = TRUE; SET @@global.max_allowed_packet = TRUE;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '1' Warning 1292 Truncated incorrect max_allowed_packet value: '1'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1024 1024
SET @@global.max_allowed_packet = FALSE; SET @@global.max_allowed_packet = FALSE;
Warnings: Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '0' Warning 1292 Truncated incorrect max_allowed_packet value: '0'
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
1024 1024
'#---------------------FN_DYNVARS_070_09----------------------#' '#---------------------FN_DYNVARS_070_09----------------------#'
SET @@global.max_allowed_packet = 2048; SET @@global.max_allowed_packet = 2048;
Warnings:
Warning 1708 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length'
SELECT @@max_allowed_packet = @@global.max_allowed_packet; SELECT @@max_allowed_packet = @@global.max_allowed_packet;
@@max_allowed_packet = @@global.max_allowed_packet @@max_allowed_packet = @@global.max_allowed_packet
0 0
......
...@@ -23,6 +23,8 @@ SELECT @@session.net_buffer_length; ...@@ -23,6 +23,8 @@ SELECT @@session.net_buffer_length;
'#--------------------FN_DYNVARS_070_02-------------------------#' '#--------------------FN_DYNVARS_070_02-------------------------#'
## Setting value of max_allowed packet and net_buffer_length to 1024 ## ## Setting value of max_allowed packet and net_buffer_length to 1024 ##
SET @@global.max_allowed_packet = 1024; 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.net_buffer_length = 1024;
SELECT @@global.max_allowed_packet; SELECT @@global.max_allowed_packet;
@@global.max_allowed_packet @@global.max_allowed_packet
......
...@@ -1292,6 +1292,34 @@ SET @@global.max_join_size=DEFAULT; ...@@ -1292,6 +1292,34 @@ SET @@global.max_join_size=DEFAULT;
SET @@global.key_buffer_size=@kbs; SET @@global.key_buffer_size=@kbs;
SET @@global.key_cache_block_size=@kcbs; SET @@global.key_cache_block_size=@kcbs;
--echo #
--echo # Bug #11766769 : 59959: SMALL VALUES OF --MAX-ALLOWED-PACKET
--echo # ARE NOT BEING HONORED
--echo #
CREATE TABLE t1 (a MEDIUMTEXT);
SET GLOBAL max_allowed_packet=2048;
SET GLOBAL net_buffer_length=4096;
CONNECT (con1,localhost,root,,test);
SHOW SESSION VARIABLES LIKE 'max_allowed_packet';
SHOW SESSION VARIABLES LIKE 'net_buffer_length';
--disable_query_log
--error ER_NET_PACKET_TOO_LARGE
INSERT INTO t1 VALUES ('123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890');
--enable_query_log
--echo at this point the connection is disconnected by the server
CONNECTION default;
DISCONNECT con1;
SELECT LENGTH(a) FROM t1;
SET GLOBAL max_allowed_packet=default;
SET GLOBAL net_buffer_length=default;
DROP TABLE t1;
--echo End of 5.1 tests --echo End of 5.1 tests
########################################################################### ###########################################################################
......
...@@ -7282,6 +7282,14 @@ static int get_options(int *argc_ptr, char ***argv_ptr) ...@@ -7282,6 +7282,14 @@ static int get_options(int *argc_ptr, char ***argv_ptr)
opt_log_slow_slave_statements) && opt_log_slow_slave_statements) &&
!opt_slow_log) !opt_slow_log)
sql_print_warning("options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set"); sql_print_warning("options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set");
if (global_system_variables.net_buffer_length >
global_system_variables.max_allowed_packet)
{
sql_print_warning("net_buffer_length (%lu) is set to be larger "
"than max_allowed_packet (%lu). Please rectify.",
global_system_variables.net_buffer_length,
global_system_variables.max_allowed_packet);
}
if (log_error_file_ptr != disabled_my_option) if (log_error_file_ptr != disabled_my_option)
opt_error_log= 1; opt_error_log= 1;
......
...@@ -6402,3 +6402,6 @@ ER_MULTI_UPDATE_KEY_CONFLICT ...@@ -6402,3 +6402,6 @@ ER_MULTI_UPDATE_KEY_CONFLICT
# message as mysqlcheck parses the error message looking for ALTER TABLE. # message as mysqlcheck parses the error message looking for ALTER TABLE.
ER_TABLE_NEEDS_REBUILD ER_TABLE_NEEDS_REBUILD
eng "Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!" eng "Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!"
WARN_OPTION_BELOW_LIMIT
eng "The value of '%s' should be no less than the value of '%s'"
...@@ -1030,13 +1030,32 @@ static bool session_readonly(sys_var *self, THD *thd, set_var *var) ...@@ -1030,13 +1030,32 @@ static bool session_readonly(sys_var *self, THD *thd, set_var *var)
self->name.str, "GLOBAL"); self->name.str, "GLOBAL");
return true; return true;
} }
static bool
check_max_allowed_packet(sys_var *self, THD *thd, set_var *var)
{
longlong val;
if (session_readonly(self, thd, var))
return true;
val= var->save_result.ulonglong_value;
if (val < (longlong) global_system_variables.net_buffer_length)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_OPTION_BELOW_LIMIT, ER(WARN_OPTION_BELOW_LIMIT),
"max_allowed_packet", "net_buffer_length");
}
return false;
}
static Sys_var_ulong Sys_max_allowed_packet( static Sys_var_ulong Sys_max_allowed_packet(
"max_allowed_packet", "max_allowed_packet",
"Max packet length to send to or receive from the server", "Max packet length to send to or receive from the server",
SESSION_VAR(max_allowed_packet), CMD_LINE(REQUIRED_ARG), SESSION_VAR(max_allowed_packet), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 1024*1024*1024), DEFAULT(1024*1024), VALID_RANGE(1024, 1024*1024*1024), DEFAULT(1024*1024),
BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG, BLOCK_SIZE(1024), NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(session_readonly)); ON_CHECK(check_max_allowed_packet));
static Sys_var_ulonglong Sys_max_binlog_cache_size( static Sys_var_ulonglong Sys_max_binlog_cache_size(
"max_binlog_cache_size", "max_binlog_cache_size",
...@@ -1267,12 +1286,29 @@ static Sys_var_mybool Sys_named_pipe( ...@@ -1267,12 +1286,29 @@ static Sys_var_mybool Sys_named_pipe(
DEFAULT(FALSE)); DEFAULT(FALSE));
#endif #endif
static bool
check_net_buffer_length(sys_var *self, THD *thd, set_var *var)
{
longlong val;
if (session_readonly(self, thd, var))
return true;
val= var->save_result.ulonglong_value;
if (val > (longlong) global_system_variables.max_allowed_packet)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_OPTION_BELOW_LIMIT, ER(WARN_OPTION_BELOW_LIMIT),
"max_allowed_packet", "net_buffer_length");
}
return false;
}
static Sys_var_ulong Sys_net_buffer_length( static Sys_var_ulong Sys_net_buffer_length(
"net_buffer_length", "net_buffer_length",
"Buffer length for TCP/IP and socket communication", "Buffer length for TCP/IP and socket communication",
SESSION_VAR(net_buffer_length), CMD_LINE(REQUIRED_ARG), SESSION_VAR(net_buffer_length), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(1024, 1024*1024), DEFAULT(16384), BLOCK_SIZE(1024), VALID_RANGE(1024, 1024*1024), DEFAULT(16384), BLOCK_SIZE(1024),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(session_readonly)); NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_net_buffer_length));
static bool fix_net_read_timeout(sys_var *self, THD *thd, enum_var_type type) static bool fix_net_read_timeout(sys_var *self, THD *thd, enum_var_type type)
{ {
......
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