mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-15391 Server crashes in JOIN::fix_all_splittings_in_plan or Assertion `join->best_read < double(1.79...e+308L)' failed
vers_setup_conds() used to AND all conditions on row_start/row_end columns and store it either in the WHERE clause or in the ON clause for some table. In some cases this caused ON clause to have conditions for tables that aren't part of that ON's join. Fixed to put a table's condition always in the ON clause of the corresponding table. Removed unnecessary ... `OR row_end IS NULL` clause, it's not needed in the ON clause. Simplified handling on PS and SP.
This commit is contained in:
@ -153,21 +153,21 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`x` AS `IJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME ALL join `test`.`t2` FOR SYSTEM_TIME ALL where `test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0` and `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0`
|
||||
Note 1003 select `test`.`t1`.`x` AS `IJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME ALL join `test`.`t2` FOR SYSTEM_TIME ALL where `test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0` and `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0`
|
||||
explain extended select * from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`x` AS `LJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME ALL left join `test`.`t2` FOR SYSTEM_TIME ALL on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0` and `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0`) where 1
|
||||
Note 1003 select `test`.`t1`.`x` AS `LJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME ALL left join `test`.`t2` FOR SYSTEM_TIME ALL on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0`) where `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0`
|
||||
explain extended select * from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`x` AS `RJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t2` FOR SYSTEM_TIME ALL left join `test`.`t1` FOR SYSTEM_TIME ALL on(`test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0` and `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0`) where 1
|
||||
Note 1003 select `test`.`t1`.`x` AS `RJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t2` FOR SYSTEM_TIME ALL left join `test`.`t1` FOR SYSTEM_TIME ALL on(`test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0`) where `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0`
|
||||
select * from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
|
||||
for system_time as of timestamp @t0 as t;
|
||||
IJ2_x1 y1 x2 y2
|
||||
@ -287,6 +287,14 @@ create or replace table t1 (a int) with system versioning;
|
||||
insert into t1 values (1);
|
||||
insert into t1 values (2);
|
||||
insert into t1 values (3);
|
||||
explain extended
|
||||
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
|
||||
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a` from `test`.`t1` FOR SYSTEM_TIME ALL left join (`test`.`t1` FOR SYSTEM_TIME ALL `t2` left join `test`.`t1` FOR SYSTEM_TIME ALL `t3` on(`test`.`t3`.`a` = `test`.`t2`.`a` and `test`.`t3`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999')) on(`test`.`t2`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999' and `test`.`t1`.`a` > 1) where `test`.`t1`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999'
|
||||
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
|
||||
a a
|
||||
2 1
|
||||
@ -382,20 +390,24 @@ create or replace table t1 (x int) with system versioning;
|
||||
select * from t1 for system_time as of current_timestamp;
|
||||
x
|
||||
select * from t1 for system_time as of now;
|
||||
ERROR 42S22: Unknown column 'now' in 'where clause'
|
||||
ERROR 42S22: Unknown column 'now' in 'on clause'
|
||||
### Issue #405, NATURAL JOIN failure
|
||||
create or replace table t1 (a int) with system versioning;
|
||||
create or replace table t2 (b int);
|
||||
create or replace view v1 as select a, row_start, row_end from t1 where a > round(rand()*1000);
|
||||
select * from v1 natural join t2;
|
||||
a b
|
||||
### Issue #406, MDEV-14633 Assertion on TRT read
|
||||
#
|
||||
# Issue #406, MDEV-14633 Assertion on TRT read
|
||||
#
|
||||
create or replace table t1 (pk int primary key, i int, t time, key (i)) with system versioning;
|
||||
insert into t1 values (1, 10, '15:01:53'), (2, 20, '00:00:00');
|
||||
delete from t1;
|
||||
select * from t1 where t = '00:00:00' and i > 0 and row_end <> '2012-12-12 00:00:00';
|
||||
pk i t
|
||||
### MDEV-14816 Assertion `join->best_read < double(1.797...e+308L)' failed in bool greedy_search
|
||||
#
|
||||
# MDEV-14816 Assertion `join->best_read < double(1.797...e+308L)' failed in bool greedy_search
|
||||
#
|
||||
create or replace table t1 (f1 int) with system versioning;
|
||||
create or replace table t2 (f2 int) with system versioning;
|
||||
create or replace table t3 (f3 int);
|
||||
@ -464,7 +476,9 @@ f1 f2 f3 f1 f2 f3 f4
|
||||
3 3 NULL NULL 3 1 1
|
||||
3 3 NULL NULL 3 2 1
|
||||
4 NULL NULL NULL NULL NULL NULL
|
||||
### MDEV-15004 parser greedily parses AS OF TIMESTAMP
|
||||
#
|
||||
# MDEV-15004 parser greedily parses AS OF TIMESTAMP
|
||||
#
|
||||
select timestamp'2016-02-30 08:07:06';
|
||||
ERROR HY000: Incorrect DATETIME value: '2016-02-30 08:07:06'
|
||||
select * from t1 for system_time as of timestamp'2016-02-30 08:07:06';
|
||||
@ -474,6 +488,28 @@ timestamp('2003-12-31 12:00:00','12:00:00')
|
||||
2004-01-01 00:00:00
|
||||
select * from t1 for system_time as of timestamp('2003-12-31 12:00:00','12:00:00');
|
||||
f1
|
||||
#
|
||||
# MDEV-15391 Server crashes in JOIN::fix_all_splittings_in_plan or Assertion `join->best_read < double(1.79...e+308L)' failed [tempesta-tech#475]
|
||||
#
|
||||
create or replace table t1 (f1 int) with system versioning;
|
||||
insert t1 values (1),(2);
|
||||
create or replace table t2 (f2 int);
|
||||
create or replace table t3 (f3 int);
|
||||
create or replace table t4 (f4 int) with system versioning;
|
||||
select f1 from t1 join t2 left join t3 left join t4 on f3 = f4 on f3 = f2;
|
||||
f1
|
||||
insert t2 values (1),(2);
|
||||
insert t3 values (1),(2);
|
||||
insert t4 values (1),(2);
|
||||
explain extended
|
||||
select f1 from t1 join t2 left join t3 left join t4 on f3 = f4 on f3 = f2;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using join buffer (flat, BNL join)
|
||||
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` FOR SYSTEM_TIME ALL join `test`.`t2` left join (`test`.`t3` left join `test`.`t4` FOR SYSTEM_TIME ALL on(`test`.`t4`.`f4` = `test`.`t2`.`f2` and `test`.`t4`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999')) on(`test`.`t3`.`f3` = `test`.`t2`.`f2`) where `test`.`t1`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999'
|
||||
drop view v1;
|
||||
drop table t1, t2, t3, t4;
|
||||
call verify_vtq_dummy(34);
|
||||
|
Reference in New Issue
Block a user