From: Georgi Kodinov Date: March 25 2011 2:38pm Subject: bzr push into mysql-trunk branch (Georgi.Kodinov:3326) List-Archive: http://lists.mysql.com/commits/133894 Message-Id: <201103251438.p2PEcunG026615@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3326 Georgi Kodinov 2011-03-25 [merge] merge added: mysql-test/r/tablespace.result mysql-test/std_data/cluster_7022_table.MYD mysql-test/std_data/cluster_7022_table.MYI mysql-test/std_data/cluster_7022_table.frm mysql-test/t/tablespace.test modified: include/mysql_com.h sql/handler.h sql/sql_show.cc sql/sql_table.cc sql/table.cc sql/table.h sql/unireg.cc === modified file 'mysql-test/r/packet.result' --- a/mysql-test/r/packet.result 2009-06-19 09:29:21 +0000 +++ b/mysql-test/r/packet.result 2011-03-25 14:35:13 +0000 @@ -3,6 +3,7 @@ set @net_buffer_length=@@global.net_buff set global max_allowed_packet=100; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '100' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' set global net_buffer_length=100; Warnings: Warning 1292 Truncated incorrect net_buffer_length value: '100' === modified file 'mysql-test/r/variables.result' --- a/mysql-test/r/variables.result 2011-03-15 13:03:22 +0000 +++ b/mysql-test/r/variables.result 2011-03-25 14:35:13 +0000 @@ -504,6 +504,7 @@ set low_priority_updates=1; set global max_allowed_packet=100; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '100' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' set global max_binlog_cache_size=100; Warnings: Warning 1292 Truncated incorrect max_binlog_cache_size value: '100' @@ -1050,6 +1051,8 @@ set global max_write_lock_count =de 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 net_buffer_length =@my_net_buffer_length; +Warnings: +Warning 1732 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_read_timeout =@my_net_read_timeout; set global query_cache_limit =@my_query_cache_limit; @@ -1537,6 +1540,30 @@ SET @@global.binlog_cache_size=DEFAULT; SET @@global.max_join_size=DEFAULT; SET @@global.key_buffer_size=@kbs; 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 1732 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 1732 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 # === modified file 'mysql-test/suite/rpl/r/rpl_packet.result' --- a/mysql-test/suite/rpl/r/rpl_packet.result 2010-12-19 17:22:30 +0000 +++ b/mysql-test/suite/rpl/r/rpl_packet.result 2011-03-25 14:35:13 +0000 @@ -73,6 +73,8 @@ WARNING: The range of printed events end ==== clean up ==== DROP TABLE t1; SET @@global.max_allowed_packet= 1024; +Warnings: +Warning 1732 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.max_allowed_packet= 1024; DROP TABLE t1; === modified file 'mysql-test/suite/rpl/t/rpl_loaddata_map-master.opt' --- a/mysql-test/suite/rpl/t/rpl_loaddata_map-master.opt 2008-02-05 13:52:20 +0000 +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map-master.opt 2011-03-25 10:57:27 +0000 @@ -1 +1 @@ ---read_buffer_size=12K --max_allowed_packet=8K +--read_buffer_size=12K --max_allowed_packet=8K --net-buffer-length=8K === modified file 'mysql-test/suite/rpl/t/rpl_loaddata_map-slave.opt' --- a/mysql-test/suite/rpl/t/rpl_loaddata_map-slave.opt 2008-02-05 13:52:20 +0000 +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map-slave.opt 2011-03-25 10:57:27 +0000 @@ -1 +1 @@ ---max_allowed_packet=8K +--max_allowed_packet=8K --net-buffer-length=8K === modified file 'mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result' --- a/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result 2009-12-22 09:35:56 +0000 +++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_basic.result 2011-03-25 14:35:13 +0000 @@ -7,6 +7,7 @@ SET @@global.max_allowed_packet = DEFAUL SET @@global.max_allowed_packet = 1000; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '1000' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SET @@global.max_allowed_packet = DEFAULT; SELECT @@global.max_allowed_packet; @@global.max_allowed_packet @@ -25,12 +26,15 @@ SELECT @@global.max_allowed_packet = 104 1 '#--------------------FN_DYNVARS_070_03-------------------------#' SET @@global.max_allowed_packet = 1024; +Warnings: +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SELECT @@global.max_allowed_packet; @@global.max_allowed_packet 1024 SET @@global.max_allowed_packet = 1025; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '1025' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SELECT @@global.max_allowed_packet; @@global.max_allowed_packet 1024 @@ -74,18 +78,21 @@ SELECT @@session.max_allowed_packet; SET @@global.max_allowed_packet = 0; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '0' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SELECT @@global.max_allowed_packet; @@global.max_allowed_packet 1024 SET @@global.max_allowed_packet = -1024; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '-1024' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SELECT @@global.max_allowed_packet; @@global.max_allowed_packet 1024 SET @@global.max_allowed_packet = 1023; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '1023' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SELECT @@global.max_allowed_packet; @@global.max_allowed_packet 1024 @@ -148,17 +155,21 @@ WHERE VARIABLE_NAME='max_allowed_packet' SET @@global.max_allowed_packet = TRUE; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '1' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SELECT @@global.max_allowed_packet; @@global.max_allowed_packet 1024 SET @@global.max_allowed_packet = FALSE; Warnings: Warning 1292 Truncated incorrect max_allowed_packet value: '0' +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SELECT @@global.max_allowed_packet; @@global.max_allowed_packet 1024 '#---------------------FN_DYNVARS_070_09----------------------#' SET @@global.max_allowed_packet = 2048; +Warnings: +Warning 1732 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; @@max_allowed_packet = @@global.max_allowed_packet 0 === modified file 'mysql-test/suite/sys_vars/r/max_allowed_packet_func.result' --- a/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result 2009-01-29 16:59:46 +0000 +++ b/mysql-test/suite/sys_vars/r/max_allowed_packet_func.result 2011-03-25 14:35:13 +0000 @@ -23,6 +23,8 @@ SELECT @@session.net_buffer_length; '#--------------------FN_DYNVARS_070_02-------------------------#' ## Setting value of max_allowed packet and net_buffer_length to 1024 ## SET @@global.max_allowed_packet = 1024; +Warnings: +Warning 1732 The value of 'max_allowed_packet' should be no less than the value of 'net_buffer_length' SET @@global.net_buffer_length = 1024; SELECT @@global.max_allowed_packet; @@global.max_allowed_packet === modified file 'mysql-test/t/variables.test' --- a/mysql-test/t/variables.test 2011-03-15 13:03:22 +0000 +++ b/mysql-test/t/variables.test 2011-03-25 14:35:13 +0000 @@ -1280,6 +1280,34 @@ SET @@global.max_join_size=DEFAULT; SET @@global.key_buffer_size=@kbs; 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 ('1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234! 5678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012! 3456789012345678901234567890123456789012345678901234567890123456789012 34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901! 2345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789! 0123456789012345678901234567890123456789012345678901234567890123456789 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678! 901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'); +--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 ########################################################################### === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2011-03-18 22:51:17 +0000 +++ b/sql/mysqld.cc 2011-03-25 14:35:13 +0000 @@ -7600,6 +7600,14 @@ static int get_options(int *argc_ptr, ch opt_log_slow_slave_statements) && !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"); + 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) opt_error_log= 1; === modified file 'sql/share/errmsg-utf8.txt' --- a/sql/share/errmsg-utf8.txt 2011-03-08 09:21:39 +0000 +++ b/sql/share/errmsg-utf8.txt 2011-03-25 14:35:13 +0000 @@ -6492,3 +6492,6 @@ ER_NO_SUCH_PARTITION # message as mysqlcheck parses the error message looking for ALTER TABLE. ER_TABLE_NEEDS_REBUILD 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'" === modified file 'sql/sys_vars.cc' --- a/sql/sys_vars.cc 2011-03-24 10:35:12 +0000 +++ b/sql/sys_vars.cc 2011-03-25 14:35:13 +0000 @@ -1179,13 +1179,32 @@ static bool session_readonly(sys_var *se self->name.str, "GLOBAL"); 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( "max_allowed_packet", "Max packet length to send to or receive from the server", SESSION_VAR(max_allowed_packet), CMD_LINE(REQUIRED_ARG), VALID_RANGE(1024, 1024*1024*1024), DEFAULT(1024*1024), 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( "max_binlog_cache_size", @@ -1413,12 +1432,29 @@ static Sys_var_mybool Sys_named_pipe( DEFAULT(FALSE)); #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( "net_buffer_length", "Buffer length for TCP/IP and socket communication", SESSION_VAR(net_buffer_length), CMD_LINE(REQUIRED_ARG), 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) { No bundle (reason: useless for push emails).