maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #08153
Fwd: MDEV-6838 Using too big key for internal temp tables
+ CC maria-developers
Hi Sergei!
I have attached the diff for MDEV-6838. Let me know your thoughts on it.
The test case now fails without the patch and passes with the patch on both
5.5 and 10.0.
Sergey Petrunia is alright with the patch.
Regards,
Vicențiu
=== added file 'mysql-test/r/internal_temp_table_key-MDEV-6838.result'
--- mysql-test/r/internal_temp_table_key-MDEV-6838.result 1970-01-01 00:00:00 +0000
+++ mysql-test/r/internal_temp_table_key-MDEV-6838.result 2015-02-10 12:35:55 +0000
@@ -0,0 +1,21 @@
+CREATE TABLE t1 (i INT, state VARCHAR(995)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (2,'Louisiana'),(9,'Maine');
+CREATE TABLE t2 (state VARCHAR(995), j INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('Louisiana',9),('Alaska',5);
+INSERT INTO t2 SELECT t2.* FROM t2 JOIN t2 AS t3 JOIN t2 AS t4 JOIN t2 AS t5;
+SET @@max_heap_table_size= 16384;
+set @@optimizer_switch='derived_merge=OFF';
+set @@optimizer_switch='extended_keys=ON';
+SELECT * FROM t1 AS t1_1 LEFT JOIN ( t1 AS t1_2 INNER JOIN (SELECT * FROM t2) v2 ON t1_2.i = j ) ON t1_1.state = v2.state;
+i state i state state j
+2 Louisiana 9 Maine Louisiana 9
+2 Louisiana 9 Maine Louisiana 9
+2 Louisiana 9 Maine Louisiana 9
+2 Louisiana 9 Maine Louisiana 9
+2 Louisiana 9 Maine Louisiana 9
+2 Louisiana 9 Maine Louisiana 9
+2 Louisiana 9 Maine Louisiana 9
+2 Louisiana 9 Maine Louisiana 9
+2 Louisiana 9 Maine Louisiana 9
+9 Maine NULL NULL NULL NULL
+DROP TABLE t1, t2;
=== added file 'mysql-test/t/internal_temp_table_key-MDEV-6838.test'
--- mysql-test/t/internal_temp_table_key-MDEV-6838.test 1970-01-01 00:00:00 +0000
+++ mysql-test/t/internal_temp_table_key-MDEV-6838.test 2015-02-10 12:35:48 +0000
@@ -0,0 +1,14 @@
+CREATE TABLE t1 (i INT, state VARCHAR(995)) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (2,'Louisiana'),(9,'Maine');
+
+CREATE TABLE t2 (state VARCHAR(995), j INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES ('Louisiana',9),('Alaska',5);
+INSERT INTO t2 SELECT t2.* FROM t2 JOIN t2 AS t3 JOIN t2 AS t4 JOIN t2 AS t5;
+
+SET @@max_heap_table_size= 16384;
+set @@optimizer_switch='derived_merge=OFF';
+set @@optimizer_switch='extended_keys=ON';
+
+SELECT * FROM t1 AS t1_1 LEFT JOIN ( t1 AS t1_2 INNER JOIN (SELECT * FROM t2) v2 ON t1_2.i = j ) ON t1_1.state = v2.state;
+
+DROP TABLE t1, t2;
=== modified file 'sql/sql_select.cc'
--- sql/sql_select.cc 2014-12-18 17:38:47 +0000
+++ sql/sql_select.cc 2015-02-10 12:31:57 +0000
@@ -15921,7 +15921,7 @@
goto err;
bzero(seg, sizeof(*seg) * keyinfo->key_parts);
- if (keyinfo->key_length >= table->file->max_key_length() ||
+ if (keyinfo->key_length > table->file->max_key_length() ||
keyinfo->key_parts > table->file->max_key_parts() ||
share->uniques)
{
@@ -16107,7 +16107,7 @@
goto err;
bzero(seg, sizeof(*seg) * keyinfo->key_parts);
- if (keyinfo->key_length >= table->file->max_key_length() ||
+ if (keyinfo->key_length > table->file->max_key_length() ||
keyinfo->key_parts > table->file->max_key_parts() ||
share->uniques)
{
Follow ups