Skip to content

Commit

Permalink
MDEV-15391 Server crashes in JOIN::fix_all_splittings_in_plan or Asse…
Browse files Browse the repository at this point in the history
…rtion `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.
  • Loading branch information
vuvova committed Apr 10, 2018
1 parent 1a86fc5 commit a4251d6
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 62 deletions.
4 changes: 2 additions & 2 deletions mysql-test/suite/versioning/r/derived.result
Expand Up @@ -211,12 +211,12 @@ 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)
Query A:
Note 1003 select `test`.`t1`.`x` AS `x`,`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` > <cache>(current_timestamp(6)) and `test`.`t1`.`row_start` <= <cache>(current_timestamp(6)) and `test`.`t2`.`row_end` > <cache>(current_timestamp(6)) and `test`.`t2`.`row_start` <= <cache>(current_timestamp(6))
Note 1003 select `test`.`t1`.`x` AS `x`,`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` > <cache>(current_timestamp(6)) and `test`.`t2`.`row_start` <= <cache>(current_timestamp(6)) and `test`.`t1`.`row_end` > <cache>(current_timestamp(6)) and `test`.`t1`.`row_start` <= <cache>(current_timestamp(6))
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)
Query B:
Note 1003 select `test`.`t1`.`x` AS `x`,`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` > <cache>(current_timestamp(6)) and `test`.`t1`.`row_start` <= <cache>(current_timestamp(6)) and `test`.`t2`.`row_end` > <cache>(current_timestamp(6)) and `test`.`t2`.`row_start` <= <cache>(current_timestamp(6))
Note 1003 select `test`.`t1`.`x` AS `x`,`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` > <cache>(current_timestamp(6)) and `test`.`t2`.`row_start` <= <cache>(current_timestamp(6)) and `test`.`t1`.`row_end` > <cache>(current_timestamp(6)) and `test`.`t1`.`row_start` <= <cache>(current_timestamp(6))
Fine result: queries A and B are equal.
## LEFT JOIN: t1, t2 versioned
select * from (
Expand Down
54 changes: 45 additions & 9 deletions mysql-test/suite/versioning/r/select.result
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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';
Expand All @@ -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);
Expand Down
30 changes: 27 additions & 3 deletions mysql-test/suite/versioning/t/select.test
Expand Up @@ -182,6 +182,8 @@ 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;
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;

create or replace table t1 (x int) with system versioning;
Expand Down Expand Up @@ -269,15 +271,19 @@ 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;

--echo ### Issue #406, MDEV-14633 Assertion on TRT read
--echo #
--echo # Issue #406, MDEV-14633 Assertion on TRT read
--echo #
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;
--disable_warnings
select * from t1 where t = '00:00:00' and i > 0 and row_end <> '2012-12-12 00:00:00';
--enable_warnings

--echo ### MDEV-14816 Assertion `join->best_read < double(1.797...e+308L)' failed in bool greedy_search
--echo #
--echo # MDEV-14816 Assertion `join->best_read < double(1.797...e+308L)' failed in bool greedy_search
--echo #
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);
Expand All @@ -291,14 +297,32 @@ select * from
left join t2 as t2a left join (t3 as t3a inner join t1) on t2a.f2 = t3a.f3 on t1a.f1 = t2a.f2
left join (t2 join t3 inner join t4) on t2a.f2 = t1a.f1;

--echo ### MDEV-15004 parser greedily parses AS OF TIMESTAMP
--echo #
--echo # MDEV-15004 parser greedily parses AS OF TIMESTAMP
--echo #
--error ER_WRONG_VALUE
select timestamp'2016-02-30 08:07:06';
--error ER_WRONG_VALUE
select * from t1 for system_time as of timestamp'2016-02-30 08:07:06';
select timestamp('2003-12-31 12:00:00','12:00:00');
select * from t1 for system_time as of timestamp('2003-12-31 12:00:00','12:00:00');


--echo #
--echo # 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]
--echo #
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;
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;

drop view v1;
drop table t1, t2, t3, t4;

Expand Down
8 changes: 6 additions & 2 deletions sql/sql_delete.cc
Expand Up @@ -318,9 +318,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_ASSERT(table);

DBUG_ASSERT(!conds || thd->stmt_arena->is_stmt_execute());
if (select_lex->vers_setup_conds(thd, table_list, &conds))
if (select_lex->vers_setup_conds(thd, table_list))
DBUG_RETURN(TRUE);

DBUG_ASSERT(!conds);
conds= table_list->on_expr;
table_list->on_expr= NULL;

// trx_sees() in InnoDB reads row_start
if (!table->versioned(VERS_TIMESTAMP))
{
Expand Down Expand Up @@ -941,7 +945,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list,
my_error(ER_IT_IS_A_VIEW, MYF(0), table_list->table_name.str);
DBUG_RETURN(true);
}
if (select_lex->vers_setup_conds(thd, table_list, conds))
if (select_lex->vers_setup_conds(thd, table_list))
DBUG_RETURN(true);
}
if ((wild_num && setup_wild(thd, table_list, field_list, NULL, wild_num)) ||
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_lex.h
Expand Up @@ -1044,7 +1044,7 @@ class st_select_lex: public st_select_lex_node
/** System Versioning */
public:
uint versioned_tables;
int vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr);
int vers_setup_conds(THD *thd, TABLE_LIST *tables);
/* push new Item_field into item_list */
bool vers_push_field(THD *thd, TABLE_LIST *table, const LEX_CSTRING field_name);

Expand Down
54 changes: 9 additions & 45 deletions sql/sql_select.cc
Expand Up @@ -718,7 +718,7 @@ void vers_select_conds_t::print(String *str, enum_query_type query_type)
}
}

int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr)
int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables)
{
DBUG_ENTER("SELECT_LEX::vers_setup_cond");
#define newx new (thd->mem_root)
Expand Down Expand Up @@ -777,9 +777,6 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
}
}

COND** dst_cond= where_expr;
COND* vers_cond= NULL;

for (table= tables; table; table= table->next_local)
{
if (!table->table || !table->table->versioned())
Expand Down Expand Up @@ -830,11 +827,6 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
lock_type= TL_READ; // ignore TL_WRITE, history is immutable anyway
}

if (table->on_expr)
{
dst_cond= &table->on_expr;
}

const LEX_CSTRING *fstart= &table->table->vers_start_field()->field_name;
const LEX_CSTRING *fend= &table->table->vers_end_field()->field_name;

Expand Down Expand Up @@ -875,7 +867,6 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
max_time.second_part= TIME_MAX_SECOND_PART;
curr= newx Item_datetime_literal(thd, &max_time, TIME_SECOND_PART_DIGITS);
cond1= newx Item_func_eq(thd, row_end, curr);
cond1= or_items(thd, cond1, newx Item_func_isnull(thd, row_end));
break;
case SYSTEM_TIME_AS_OF:
cond1= newx Item_func_le(thd, row_start, vers_conditions.start.item);
Expand Down Expand Up @@ -938,42 +929,15 @@ int SELECT_LEX::vers_setup_conds(THD *thd, TABLE_LIST *tables, COND **where_expr
DBUG_ASSERT(0);
}
}
vers_conditions.type= SYSTEM_TIME_ALL;

if (cond1)
{
vers_cond= and_items(thd,
vers_cond,
and_items(thd,
cond2,
cond1));
if (table->is_view_or_derived())
vers_cond= or_items(thd, vers_cond, newx Item_func_isnull(thd, row_end));
}
} // for (table= tables; ...)

if (vers_cond)
{
COND *all_cond= and_items(thd, *dst_cond, vers_cond);
bool from_where= dst_cond == where_expr;
if (on_stmt_arena.arena_replaced())
*dst_cond= all_cond;
else
thd->change_item_tree(dst_cond, all_cond);

if (from_where)
{
this->where= *dst_cond;
this->where->top_level_item();
cond1= and_items(thd, cond2, cond1);
table->on_expr= and_items(thd, table->on_expr, cond1);

This comment has been minimized.

Copy link
@kevgs

kevgs Apr 10, 2018

Contributor

https://jira.mariadb.org/browse/MDEV-15842

It was possible to fix that issue when AS OF was added to conds. Is it possible now when AS OF is on TABLE_LIST::on_expr?

}

// Invalidate current SP [#52, #422]
if (thd->spcont)
{
DBUG_ASSERT(thd->spcont->m_sp);
thd->spcont->m_sp->set_sp_cache_version(0);
}
}
table->vers_conditions.type= SYSTEM_TIME_ALL;
} // for (table= tables; ...)

DBUG_RETURN(0);
#undef newx
Expand Down Expand Up @@ -1059,7 +1023,7 @@ JOIN::prepare(TABLE_LIST *tables_init,
}

/* System Versioning: handle FOR SYSTEM_TIME clause. */
if (select_lex->vers_setup_conds(thd, tables_list, &conds) < 0)
if (select_lex->vers_setup_conds(thd, tables_list) < 0)
DBUG_RETURN(-1);

/*
Expand Down Expand Up @@ -7533,7 +7497,7 @@ static int compare_embedding_subqueries(JOIN_TAB *jt1, JOIN_TAB *jt2)
b: dependent = 0x0 table->map = 0x2 found_records = 3 ptr = 0x907e838
c: dependent = 0x6 table->map = 0x10 found_records = 2 ptr = 0x907ecd0

As for subuqueries, this function must produce order that can be fed to
As for subqueries, this function must produce order that can be fed to
choose_initial_table_order().

@retval
Expand Down Expand Up @@ -7871,7 +7835,7 @@ greedy_search(JOIN *join,
'best_read < DBL_MAX' means that optimizer managed to find
some plan and updated 'best_positions' array accordingly.
*/
DBUG_ASSERT(join->best_read < DBL_MAX);
DBUG_ASSERT(join->best_read < DBL_MAX);

if (size_remain <= search_depth)
{
Expand Down Expand Up @@ -8629,7 +8593,7 @@ best_extension_by_limited_search(JOIN *join,
/* Find the best access method from 's' to the current partial plan */
POSITION loose_scan_pos;
best_access_path(join, s, remaining_tables, idx, disable_jbuf,
record_count, join->positions + idx, &loose_scan_pos);
record_count, position, &loose_scan_pos);

/* Compute the cost of extending the plan with 's', avoid overflow */
if (position->records_read < DBL_MAX / record_count)
Expand Down

0 comments on commit a4251d6

Please sign in to comment.