diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-12-03 09:56:30 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-12-03 09:56:30 +0200 |
commit | f458acc81e805d148e01f60fe5c2ded622df7c01 (patch) | |
tree | 4b65e8c450532621741883e486b3880d363c0864 | |
parent | 658a1e1fed81504c027f1d0d81abad5b9bb6c0d4 (diff) | |
download | mariadb-git-st-10.4-marko.tar.gz |
MDEV-27160 Out of memory in main.long_uniquest-10.4-marko
A part of the test main.long_unique attempts to insert records
with two 60,000,001-byte columns. Let us move that test into
a separate file main.long_unique_big, declared as big test,
so that it can be skipped in environments with limited memory.
-rw-r--r-- | mysql-test/main/long_unique.result | 43 | ||||
-rw-r--r-- | mysql-test/main/long_unique.test | 29 | ||||
-rw-r--r-- | mysql-test/main/long_unique_big.result | 38 | ||||
-rw-r--r-- | mysql-test/main/long_unique_big.test | 26 |
4 files changed, 66 insertions, 70 deletions
diff --git a/mysql-test/main/long_unique.result b/mysql-test/main/long_unique.result index 23d25e2f124..755612c7915 100644 --- a/mysql-test/main/long_unique.result +++ b/mysql-test/main/long_unique.result @@ -3,7 +3,6 @@ #table containing single unique column #table containing keys like unique(a,b,c,d) etc #then table containing 2 blob unique etc -set @allowed_packet= @@max_allowed_packet; #table with single long blob column; create table t1(a blob unique ); insert into t1 values(1),(2),(3),(56),('sachin'),('maria'),(123456789034567891),(null),(null),(123456789034567890); @@ -1225,44 +1224,6 @@ DB_ROW_HASH_1 33 44 drop table t1,t2; -#very long blob entry; -SET @@GLOBAL.max_allowed_packet=67108864; -connect 'newcon', localhost, root,,; -connection newcon; -show variables like 'max_allowed_packet'; -Variable_name Value -max_allowed_packet 67108864 -create table t1(a longblob unique, b longblob , c longblob , unique(b,c)); -desc t1; -Field Type Null Key Default Extra -a longblob YES UNI NULL -b longblob YES MUL NULL -c longblob YES NULL -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` longblob DEFAULT NULL, - `b` longblob DEFAULT NULL, - `c` longblob DEFAULT NULL, - UNIQUE KEY `a` (`a`) USING HASH, - UNIQUE KEY `b` (`b`,`c`) USING HASH -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -show keys from t1; -Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 a 1 a A NULL NULL NULL YES HASH -t1 0 b 1 b A NULL NULL NULL YES HASH -t1 0 b 2 c A NULL NULL NULL YES HASH -insert into t1 values(concat(repeat('sachin',10000000),'1'),concat(repeat('sachin',10000000),'1'), -concat(repeat('sachin',10000000),'1')); -insert into t1 values(concat(repeat('sachin',10000000),'2'),concat(repeat('sachin',10000000),'2'), -concat(repeat('sachin',10000000),'1')); -insert into t1 values(concat(repeat('sachin',10000000),'2'),concat(repeat('sachin',10000000),'2'), -concat(repeat('sachin',10000000),'4')); -ERROR 23000: Duplicate entry 'sachinsachinsachinsachinsachinsachinsachinsachinsachinsachins...' for key 'a' -insert into t1 values(concat(repeat('sachin',10000000),'3'),concat(repeat('sachin',10000000),'1'), -concat(repeat('sachin',10000000),'1')); -ERROR 23000: Duplicate entry 'sachinsachinsachinsachinsachinsachinsachinsachinsachinsachins...' for key 'b' -drop table t1; #long key unique with different key length create table t1(a blob, unique(a(3000))); desc t1; @@ -1307,9 +1268,6 @@ t1 0 a 2 b A NULL NULL NULL YES HASH t1 0 c 1 c A NULL 4500 NULL YES HASH t1 0 c 2 d A NULL NULL NULL YES HASH drop table t1; -disconnect newcon; -connection default; -SET @@GLOBAL.max_allowed_packet=4194304; #ext bug create table t1(a int primary key, b blob unique, c int, d blob , index(c)); show create table t1; @@ -1477,5 +1435,4 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT t2.b FROM t1 JOIN t2 ON t1.d = t2.f WHERE t2.pk >= 20; b drop table t1,t2; -set @@GLOBAL.max_allowed_packet= @allowed_packet; # End of 10.4 tests diff --git a/mysql-test/main/long_unique.test b/mysql-test/main/long_unique.test index 7aaff303ae7..f1a08b3dc29 100644 --- a/mysql-test/main/long_unique.test +++ b/mysql-test/main/long_unique.test @@ -10,7 +10,7 @@ let datadir=`select @@datadir`; --echo #table containing single unique column --echo #table containing keys like unique(a,b,c,d) etc --echo #then table containing 2 blob unique etc -set @allowed_packet= @@max_allowed_packet; + --echo #table with single long blob column; create table t1(a blob unique ); insert into t1 values(1),(2),(3),(56),('sachin'),('maria'),(123456789034567891),(null),(null),(123456789034567890); @@ -396,28 +396,6 @@ select DB_ROW_HASH_1 from t1,t2 where t1.DB_ROW_HASH_1 = t2.DB_ROW_HASH_2; select DB_ROW_HASH_1 from t1 inner join t2 on t1.a = t2.DB_ROW_HASH_2; drop table t1,t2; ---echo #very long blob entry; -SET @@GLOBAL.max_allowed_packet=67108864; - -connect ('newcon', localhost, root,,); ---connection newcon -show variables like 'max_allowed_packet'; -create table t1(a longblob unique, b longblob , c longblob , unique(b,c)); -desc t1; -show create table t1; -show keys from t1; -insert into t1 values(concat(repeat('sachin',10000000),'1'),concat(repeat('sachin',10000000),'1'), -concat(repeat('sachin',10000000),'1')); -insert into t1 values(concat(repeat('sachin',10000000),'2'),concat(repeat('sachin',10000000),'2'), -concat(repeat('sachin',10000000),'1')); ---error ER_DUP_ENTRY -insert into t1 values(concat(repeat('sachin',10000000),'2'),concat(repeat('sachin',10000000),'2'), -concat(repeat('sachin',10000000),'4')); ---error ER_DUP_ENTRY -insert into t1 values(concat(repeat('sachin',10000000),'3'),concat(repeat('sachin',10000000),'1'), -concat(repeat('sachin',10000000),'1')); -drop table t1; - --echo #long key unique with different key length create table t1(a blob, unique(a(3000))); desc t1; @@ -435,9 +413,7 @@ desc t1; show create table t1; show keys from t1; drop table t1; -disconnect newcon; ---connection default -SET @@GLOBAL.max_allowed_packet=4194304; + --echo #ext bug create table t1(a int primary key, b blob unique, c int, d blob , index(c)); show create table t1; @@ -556,5 +532,4 @@ SELECT t2.b FROM t1 JOIN t2 ON t1.d = t2.f WHERE t2.pk >= 20; SELECT t2.b FROM t1 JOIN t2 ON t1.d = t2.f WHERE t2.pk >= 20; drop table t1,t2; -set @@GLOBAL.max_allowed_packet= @allowed_packet; --echo # End of 10.4 tests diff --git a/mysql-test/main/long_unique_big.result b/mysql-test/main/long_unique_big.result new file mode 100644 index 00000000000..2ec84e510cb --- /dev/null +++ b/mysql-test/main/long_unique_big.result @@ -0,0 +1,38 @@ +set @allowed_packet= @@max_allowed_packet; +SET GLOBAL max_allowed_packet=67108864; +connect con1, localhost, root,,; +create table t1(a longblob unique, b longblob , c longblob , unique(b,c)); +desc t1; +Field Type Null Key Default Extra +a longblob YES UNI NULL +b longblob YES MUL NULL +c longblob YES NULL +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` longblob DEFAULT NULL, + `b` longblob DEFAULT NULL, + `c` longblob DEFAULT NULL, + UNIQUE KEY `a` (`a`) USING HASH, + UNIQUE KEY `b` (`b`,`c`) USING HASH +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show keys from t1; +Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment +t1 0 a 1 a A NULL NULL NULL YES HASH +t1 0 b 1 b A NULL NULL NULL YES HASH +t1 0 b 2 c A NULL NULL NULL YES HASH +insert into t1 values(concat(repeat('sachin',10000000),'1'),concat(repeat('sachin',10000000),'1'), +concat(repeat('sachin',10000000),'1')); +insert into t1 values(concat(repeat('sachin',10000000),'2'),concat(repeat('sachin',10000000),'2'), +concat(repeat('sachin',10000000),'1')); +insert into t1 values(concat(repeat('sachin',10000000),'2'),concat(repeat('sachin',10000000),'2'), +concat(repeat('sachin',10000000),'4')); +ERROR 23000: Duplicate entry 'sachinsachinsachinsachinsachinsachinsachinsachinsachinsachins...' for key 'a' +insert into t1 values(concat(repeat('sachin',10000000),'3'),concat(repeat('sachin',10000000),'1'), +concat(repeat('sachin',10000000),'1')); +ERROR 23000: Duplicate entry 'sachinsachinsachinsachinsachinsachinsachinsachinsachinsachins...' for key 'b' +drop table t1; +disconnect con1; +connection default; +set @@GLOBAL.max_allowed_packet= @allowed_packet; +# End of 10.4 tests diff --git a/mysql-test/main/long_unique_big.test b/mysql-test/main/long_unique_big.test new file mode 100644 index 00000000000..c87b6e0b9eb --- /dev/null +++ b/mysql-test/main/long_unique_big.test @@ -0,0 +1,26 @@ +# This test may run out of memory in some environments. +--source include/big_test.inc + +set @allowed_packet= @@max_allowed_packet; +SET GLOBAL max_allowed_packet=67108864; + +connect (con1, localhost, root,,); +create table t1(a longblob unique, b longblob , c longblob , unique(b,c)); +desc t1; +show create table t1; +show keys from t1; +insert into t1 values(concat(repeat('sachin',10000000),'1'),concat(repeat('sachin',10000000),'1'), +concat(repeat('sachin',10000000),'1')); +insert into t1 values(concat(repeat('sachin',10000000),'2'),concat(repeat('sachin',10000000),'2'), +concat(repeat('sachin',10000000),'1')); +--error ER_DUP_ENTRY +insert into t1 values(concat(repeat('sachin',10000000),'2'),concat(repeat('sachin',10000000),'2'), +concat(repeat('sachin',10000000),'4')); +--error ER_DUP_ENTRY +insert into t1 values(concat(repeat('sachin',10000000),'3'),concat(repeat('sachin',10000000),'1'), +concat(repeat('sachin',10000000),'1')); +drop table t1; +disconnect con1; +connection default; +set @@GLOBAL.max_allowed_packet= @allowed_packet; +--echo # End of 10.4 tests |