Commit 49308383 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents 14275b47 0b61f4e0
Subproject commit c2b322d2ca27ef66385d9938b98541c7cf14ac74
Subproject commit 5af90f00ffeda64795e23753c14d601cce5d02ca
......@@ -15,10 +15,12 @@ a b
2 2
select
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100
as DOUBLE) < 1.0e100 as ACCESS_METHOD_COST_IS_FINITE
from information_schema.optimizer_trace;
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100
ACCESS_METHOD_COST_IS_FINITE
1
set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
drop table t1;
#
# End of 10.5 tests
#
--source include/no_valgrind_without_big.inc
#
# Tests for group-min-max optimization that require optimizer trace
# and so need not-embedded.
#
--source include/default_optimizer_switch.inc
--source include/have_sequence.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/not_embedded.inc
--echo #
......@@ -22,8 +25,13 @@ SELECT DISTINCT * FROM t1 WHERE a IN (1, 2);
select
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100
as DOUBLE) < 1.0e100 as ACCESS_METHOD_COST_IS_FINITE
from information_schema.optimizer_trace;
set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
drop table t1;
--echo #
--echo # End of 10.5 tests
--echo #
......@@ -3424,3 +3424,18 @@ COUNT(*)
2
DROP TABLE t1, t2, t3;
# End of 10.5 tests
#
# MDEV-31449: Assertion s->table->opt_range_condition_rows <= s->found_records
#
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,2),(3,4);
CREATE TABLE t2 (c INT);
INSERT INTO t2 VALUES (5),(6);
SET @tmp=@@OPTIMIZER_USE_CONDITION_SELECTIVITY, OPTIMIZER_USE_CONDITION_SELECTIVITY = 1;
SELECT * FROM
(SELECT t1.* FROM t1 WHERE t1.a IN (SELECT MAX(t2.c) FROM t2 JOIN t1)) AS sq1,
(SELECT t2.* FROM t2 JOIN t1 ON (t1.b IN (SELECT t1.b FROM t2 STRAIGHT_JOIN t1))) AS sq2;
a b c
SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp;
DROP TABLE t1,t2;
# End of 10.6 tests
......@@ -1835,3 +1835,22 @@ SELECT COUNT(*) FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.b = t3.c) ON t1.a = t2.
DROP TABLE t1, t2, t3;
--echo # End of 10.5 tests
--echo #
--echo # MDEV-31449: Assertion s->table->opt_range_condition_rows <= s->found_records
--echo #
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,2),(3,4);
CREATE TABLE t2 (c INT);
INSERT INTO t2 VALUES (5),(6);
SET @tmp=@@OPTIMIZER_USE_CONDITION_SELECTIVITY, OPTIMIZER_USE_CONDITION_SELECTIVITY = 1;
SELECT * FROM
(SELECT t1.* FROM t1 WHERE t1.a IN (SELECT MAX(t2.c) FROM t2 JOIN t1)) AS sq1,
(SELECT t2.* FROM t2 JOIN t1 ON (t1.b IN (SELECT t1.b FROM t2 STRAIGHT_JOIN t1))) AS sq2;
SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp;
DROP TABLE t1,t2;
--echo # End of 10.6 tests
......@@ -2008,6 +2008,9 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
/* Total cost of all index accesses */
index_read_cost= primary_file->keyread_time(keynr, 1, rows);
cost->add_io(index_read_cost, 1 /* Random seeks */);
cost->cpu_cost+= (rows2double(rows) / TIME_FOR_COMPARE +
MULTI_RANGE_READ_SETUP_COST);
return FALSE;
}
......
......@@ -190,7 +190,7 @@
/* The rest of the file is included in the server only */
#ifndef MYSQL_CLIENT
/* @@optimizer_switch flags. These must be in sync with optimizer_switch_typelib */
/* @@optimizer_switch flags. These must be in sync with optimizer_switch_names */
#define OPTIMIZER_SWITCH_INDEX_MERGE (1ULL << 0)
#define OPTIMIZER_SWITCH_INDEX_MERGE_UNION (1ULL << 1)
#define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION (1ULL << 2)
......
......@@ -5799,7 +5799,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
get_delayed_table_estimates(s->table, &s->records, &s->read_time,
&s->startup_cost);
s->found_records= s->records;
table->opt_range_condition_rows=s->records;
s->table->opt_range_condition_rows=s->records;
}
else
s->scan_time();
......
......@@ -1655,9 +1655,11 @@ template<bool have_reference> inline void fil_space_t::flush()
flush_low();
else
{
if (!(acquire_low() & (STOPPING | CLOSING)))
if (!(acquire_low(STOPPING | CLOSING) & (STOPPING | CLOSING)))
{
flush_low();
release();
release();
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment