summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2023-05-05 11:26:06 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2023-05-05 11:26:06 +0200
commit37392982414c23e1b73f2c6b76241d39bb103d9e (patch)
treeba56455032f4df945c7b0e6fdca7c7e3514b2cad
parent83fa03359f0359b666c074a5dde8ae87ad6bb515 (diff)
parent2871a05ccdc846ffe7ff58fd86264d10606621c7 (diff)
downloadmariadb-git-37392982414c23e1b73f2c6b76241d39bb103d9e.tar.gz
Merge branch '10.9' into 10.10
-rw-r--r--mysql-test/main/derived_split_innodb.result16
-rw-r--r--mysql-test/main/derived_split_innodb.test23
-rw-r--r--sql/sql_select.cc2
3 files changed, 40 insertions, 1 deletions
diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result
index 2ca0de3bd91..aba4f88493c 100644
--- a/mysql-test/main/derived_split_innodb.result
+++ b/mysql-test/main/derived_split_innodb.result
@@ -823,5 +823,21 @@ a b a b a b grp_id count(*)
5 5 5 2 5 3 5 100
drop table t1,t2,t3;
drop table t10, t11;
+#
+# MDEV-31194: Server crash or assertion failure with join_cache_level=4
+# (a followup to the above bug, MDEV-26301)
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (3),(4);
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=Aria;
+INSERT INTO t2 VALUES (1),(2);
+set @tmp1= @@optimizer_switch, @tmp2= @@join_cache_level;
+set
+optimizer_switch= 'derived_with_keys=off',
+join_cache_level= 4;
+SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id= t1.a;
+a
+set optimizer_switch= @tmp1, join_cache_level= @tmp2;
+DROP TABLE t1, t2;
# End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;
diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test
index 2dd7988f223..6ccbc31d886 100644
--- a/mysql-test/main/derived_split_innodb.test
+++ b/mysql-test/main/derived_split_innodb.test
@@ -443,6 +443,29 @@ eval $q;
drop table t1,t2,t3;
drop table t10, t11;
+
+--echo #
+--echo # MDEV-31194: Server crash or assertion failure with join_cache_level=4
+--echo # (a followup to the above bug, MDEV-26301)
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (3),(4);
+
+CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=Aria;
+INSERT INTO t2 VALUES (1),(2);
+
+set @tmp1= @@optimizer_switch, @tmp2= @@join_cache_level;
+set
+ optimizer_switch= 'derived_with_keys=off',
+ join_cache_level= 4;
+
+SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id= t1.a;
+
+set optimizer_switch= @tmp1, join_cache_level= @tmp2;
+
+# Cleanup
+DROP TABLE t1, t2;
+
--echo # End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 09eb0fffa10..5ef40d39999 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13863,7 +13863,7 @@ uint check_join_cache_usage(JOIN_TAB *tab,
join->return_tab= 0;
if (tab->no_forced_join_cache)
- return 0;
+ goto no_join_cache;
/*
Don't use join cache if @@join_cache_level==0 or this table is the first