summaryrefslogtreecommitdiff
path: root/mysql-test/suite/heap
diff options
context:
space:
mode:
authorMichael Widenius <monty@mariadb.org>2014-03-26 21:58:27 +0200
committerMichael Widenius <monty@mariadb.org>2014-03-26 21:58:27 +0200
commitded448d1d035d211c8146141546a08126bb728b6 (patch)
tree0ebba8935193517995519651885a34e46ff53515 /mysql-test/suite/heap
parent99316b51b6e78191eca303dc35ae5a204f8b5c4f (diff)
downloadmariadb-git-ded448d1d035d211c8146141546a08126bb728b6.tar.gz
MDEV-5905: Creating tmp. memory table kills the server
The reason was that a couple of variables that hold number of rows that was used to calculate buffers was uint and caused an overflow. Fixed by changing variables that could hold number of rows from uint to ulong and also added a cast for this test. include/heap.h: Reorder to get better alignment. Changed variables that could hold number of rows from uint to ulong mysql-test/suite/heap/heap.result: Added test case mysql-test/suite/heap/heap.test: Added test case mysql-test/suite/plugins/t/server_audit.test: Added sleep as we want to have disconnect logged before we try a new connect storage/heap/ha_heap.cc: Changed variables that could hold number of rows from uint to ulong Limit number of rows to 4G (as most of the variables that holds rows are ulong anyway) reset records_changed when key_stat_version is changed to not cause increments for every row changed storage/heap/ha_heap.h: changed records_changed to ulong as this can get big storage/heap/hp_create.c: Changed variables that could hold number of rows from uint to ulong Added cast (fixed the original bug) storage/heap/hp_delete.c: Changed variables that could hold number of rows from uint to ulong storage/heap/hp_open.c: Removed not needed cast storage/heap/hp_write.c: Changed variables that could hold number of rows from uint to ulong support-files/compiler_warnings.supp: Removed extra : from supression
Diffstat (limited to 'mysql-test/suite/heap')
-rw-r--r--mysql-test/suite/heap/heap.result8
-rw-r--r--mysql-test/suite/heap/heap.test15
2 files changed, 23 insertions, 0 deletions
diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result
index e61b9bcc2bf..878b4aa7749 100644
--- a/mysql-test/suite/heap/heap.result
+++ b/mysql-test/suite/heap/heap.result
@@ -810,3 +810,11 @@ select data_length,index_length from information_schema.tables where table_schem
data_length index_length
81024 121024
drop table t1;
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+SET @@max_heap_table_size = 1024*1024*1024*20;
+CREATE TEMPORARY TABLE tmp ENGINE=MEMORY
+SELECT id FROM t1;
+DROP TEMPORARY TABLE tmp;
+drop table t1;
diff --git a/mysql-test/suite/heap/heap.test b/mysql-test/suite/heap/heap.test
index ab2a4f0a6d6..106ece540a4 100644
--- a/mysql-test/suite/heap/heap.test
+++ b/mysql-test/suite/heap/heap.test
@@ -563,3 +563,18 @@ insert into t1 select rand(100000000) from t1;
--replace_result 40512 81024 60512 121024
select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1";
drop table t1;
+
+#
+# MDEV-5905 Creating tmp. memory table kills the server
+#
+
+CREATE TABLE t1 (id INT);
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+
+SET @@max_heap_table_size = 1024*1024*1024*20;
+
+CREATE TEMPORARY TABLE tmp ENGINE=MEMORY
+ SELECT id FROM t1;
+DROP TEMPORARY TABLE tmp;
+drop table t1;