Wrong result with join_cache_level = 6, BKA, incremental

Bug #675922 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
High
Igor Babaev

Bug Description

Both maria-5.3 and maria-5.3-mwl128 return a wrong result on the following query:

SELECT alias1.f12 FROM t1 AS alias1 RIGHT JOIN t2 AS alias2 RIGHT JOIN t3 AS alias3 JOIN t3 AS alias4 ON alias3.f1 = alias4.f1 RIGHT JOIN t4 AS alias5 ON alias3.f6 = alias5.f2 ON alias2.f15 ON alias1.f1 = alias3.f1;

when it is executed with join_cache_level=6 and BKA.

Test case:

SET SESSION join_cache_level = 6;
SET SESSION optimizer_switch = 'join_cache_bka=on';
SET SESSION optimizer_switch = 'join_cache_incremental=on';
SET SESSION optimizer_switch = 'outer_join_with_cache=on';

CREATE TABLE t1 ( f1 int, f12 int, PRIMARY KEY (f1)) ;
INSERT IGNORE INTO t1 VALUES ('7','0');

CREATE TABLE t2 ( f15 int) ;
INSERT IGNORE INTO t2 VALUES ('9');

CREATE TABLE t3 ( f6 varchar(32), f1 int, PRIMARY KEY (f1)) ;
INSERT IGNORE INTO t3 VALUES ('s','7');

CREATE TABLE t4 ( f2 varchar(32)) ;
INSERT IGNORE INTO t4 VALUES ('s'),('k');

SELECT alias1.f12 FROM t1 AS alias1 RIGHT JOIN t2 AS alias2 RIGHT JOIN t3 AS alias3 JOIN t3 AS alias4 ON alias3.f1 = alias4.f1 RIGHT JOIN t4 AS alias5 ON alias3.f6 = alias5.f2 ON alias2.f15 ON alias1.f1 = alias3.f1;
SET SESSION join_cache_level=0;
SELECT alias1.f12 FROM t1 AS alias1 RIGHT JOIN t2 AS alias2 RIGHT JOIN t3 AS alias3 JOIN t3 AS alias4 ON alias3.f1 = alias4.f1 RIGHT JOIN t4 AS alias5 ON alias3.f6 = alias5.f2 ON alias2.f15 ON alias1.f1 = alias3.f1;

Changed in maria:
milestone: none → 5.3
assignee: nobody → Igor Babaev (igorb-seattle)
Changed in maria:
status: New → Confirmed
importance: Undecided → High
Changed in maria:
status: Confirmed → In Progress
Changed in maria:
status: In Progress → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.