summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorStaale Smedseng <staale.smedseng@sun.com>2009-06-19 11:27:19 +0200
committerStaale Smedseng <staale.smedseng@sun.com>2009-06-19 11:27:19 +0200
commit4fbd8db9b3cac7922bce2e2434726047aadfd24f (patch)
tree5e93e031147ed30778696a93de12bcf06f5d00f2 /mysql-test/t
parente3e83aca1ad7d617119c95bb9f85c81476685b5e (diff)
downloadmariadb-git-4fbd8db9b3cac7922bce2e2434726047aadfd24f.tar.gz
Bug #32223 SETting max_allowed_packet variable
Inconsistent behavior of session variable max_allowed_packet (and net_buffer_length); only assignment to the global variable has any effect, without this being obvious to the user. The patch for Bug#22891 is backported to 5.0, making the two session variables read-only. As this is a backport to GA software, the error used when trying to assign to the read- only variable is ER_UNKNOWN_ERROR. The error message is the same as in 5.1+. mysql-test/t/variables.test: Tests are changed to account for the new semantics, and assignment to the read-only variables is added to test the emission of the correct error message. sql/set_var.cc: Both max_allowed_packet and net_buffer_length are changed to be of type sys_var_thd_ulong_session_readonly. ER_UNKNOWN_ERROR is used to indicate an attempt to assign to an instance of a read-only variable. sql/set_var.h: Class sys_var_thd_ulong_session_readonly is added.
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/func_compress.test4
-rw-r--r--mysql-test/t/packet.test28
-rw-r--r--mysql-test/t/variables.test21
3 files changed, 31 insertions, 22 deletions
diff --git a/mysql-test/t/func_compress.test b/mysql-test/t/func_compress.test
index c84f22c5595..2ee222c6a10 100644
--- a/mysql-test/t/func_compress.test
+++ b/mysql-test/t/func_compress.test
@@ -43,8 +43,10 @@ drop table t1;
# note that when LOW_MEMORY is set the "test" below is meaningless
#
-set @@max_allowed_packet=1048576*100;
+set @@global.max_allowed_packet=1048576*100;
--replace_result "''" XXX "'1'" XXX
+# reconnect to make the new max packet size take effect
+--connect (newconn, localhost, root,,)
eval select compress(repeat('aaaaaaaaaa', IF('$LOW_MEMORY', 10, 10000000))) is null;
#
diff --git a/mysql-test/t/packet.test b/mysql-test/t/packet.test
index 6210e9986ad..7e08a0f6c3f 100644
--- a/mysql-test/t/packet.test
+++ b/mysql-test/t/packet.test
@@ -15,31 +15,33 @@
set @max_allowed_packet=@@global.max_allowed_packet;
set @net_buffer_length=@@global.net_buffer_length;
-connect (con1,localhost,root,,);
-connection con1;
+
+# setting values below minimum threshold of 1024 will cause truncating
set global max_allowed_packet=100;
-set max_allowed_packet=100;
set global net_buffer_length=100;
-set net_buffer_length=100;
-# Have to be > 1024 as min value of net_buffer_length is 1024
+
+# is not yet in effect
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
-# Should return NULL as 2000 is bigger than max_allowed_packet
select repeat('a',2000);
-connection default;
-disconnect con1;
#
-# Connection 2 should get error for too big packets
+# Connection 1 should get error for too big packets
#
-connect (con2,localhost,root,,);
-connection con2;
+connect (con1,localhost,root,,);
+connection con1;
select @@net_buffer_length, @@max_allowed_packet;
--error ER_NET_PACKET_TOO_LARGE
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
+connection default;
+disconnect con1;
+
+#
+# Reset to default values and reconnect
+#
set global max_allowed_packet=default;
-set max_allowed_packet=default;
set global net_buffer_length=default;
-set net_buffer_length=default;
+connect (con2,localhost,root,,);
+connection con2;
SELECT length("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") as len;
select length(repeat('a',2000));
connection default;
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 424776dfda4..91f75cf6cd4 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -131,17 +131,22 @@ show global variables like 'myisam_max_sort_file_size';
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
-set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
+set session net_write_timeout=500, net_read_timeout=600;
show global variables like 'net_%';
show session variables like 'net_%';
-set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
+set global net_buffer_length=8000, net_read_timeout=900, net_write_timeout=1000;
show global variables like 'net_%';
show session variables like 'net_%';
-set net_buffer_length=1;
-show variables like 'net_buffer_length';
+set global net_buffer_length=1;
+show global variables like 'net_buffer_length';
#warning 1292
-set net_buffer_length=2000000000;
-show variables like 'net_buffer_length';
+set global net_buffer_length=2000000000;
+show global variables like 'net_buffer_length';
+
+--error ER_UNKNOWN_ERROR
+set session net_buffer_length=1024;
+--error ER_UNKNOWN_ERROR
+set session max_allowed_packet=1024;
set character set cp1251_koi8;
show variables like "character_set_client";
@@ -272,7 +277,7 @@ set last_insert_id=1;
set global local_infile=1;
set long_query_time=100;
set low_priority_updates=1;
-set max_allowed_packet=100;
+set global max_allowed_packet=100;
set global max_binlog_cache_size=100;
set global max_binlog_size=100;
set global max_connect_errors=100;
@@ -286,7 +291,7 @@ set global max_user_connections=100;
select @@max_user_connections;
set global max_write_lock_count=100;
set myisam_sort_buffer_size=100;
-set net_buffer_length=100;
+set global net_buffer_length=100;
set net_read_timeout=100;
set net_write_timeout=100;
set global query_cache_limit=100;