1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-31194: Server crash or assertion failure with join_cache_level=4

The problem, introduced in patch for MDEV-26301:

When check_join_cache_usage() decides not to use join buffer, it must
adjust the access method accordingly. For BNL-H joins this means switching
from pseudo-"ref access"(with index=MAX_KEY) to some other access method.

Failing to do this will cause assertions down the line when code that is
not aware of BNL-H will try to initialize index use for ref access with
index=MAX_KEY.

The fix is to follow the regular code path to disable the join buffer for
the join_tab ("goto no_join_cache") instead of just returning from
check_join_cache_usage().
This commit is contained in:
Sergei Petrunia
2023-05-05 11:16:23 +03:00
parent 7973ffde0f
commit 2594da7a33
3 changed files with 40 additions and 1 deletions

View File

@ -439,4 +439,27 @@ 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