Skip to content

Commit 4930838

Browse files
committed
Merge 10.5 into 10.6
2 parents 14275b4 + 0b61f4e commit 4930838

File tree

9 files changed

+60
-11
lines changed

9 files changed

+60
-11
lines changed

libmariadb

mysql-test/main/group_min_max_notembedded.result

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ a b
1515
2 2
1616
select
1717
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
18-
as DOUBLE) < 1.0e100
18+
as DOUBLE) < 1.0e100 as ACCESS_METHOD_COST_IS_FINITE
1919
from information_schema.optimizer_trace;
20-
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
21-
as DOUBLE) < 1.0e100
20+
ACCESS_METHOD_COST_IS_FINITE
2221
1
2322
set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
2423
drop table t1;
24+
#
25+
# End of 10.5 tests
26+
#

mysql-test/main/group_min_max_notembedded.test

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
--source include/no_valgrind_without_big.inc
1+
#
2+
# Tests for group-min-max optimization that require optimizer trace
3+
# and so need not-embedded.
4+
#
25
--source include/default_optimizer_switch.inc
3-
--source include/have_sequence.inc
46
--source include/have_innodb.inc
7+
--source include/have_sequence.inc
58
--source include/not_embedded.inc
69

710
--echo #
@@ -22,8 +25,13 @@ SELECT DISTINCT * FROM t1 WHERE a IN (1, 2);
2225

2326
select
2427
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
25-
as DOUBLE) < 1.0e100
28+
as DOUBLE) < 1.0e100 as ACCESS_METHOD_COST_IS_FINITE
2629
from information_schema.optimizer_trace;
2730

2831
set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
2932
drop table t1;
33+
34+
--echo #
35+
--echo # End of 10.5 tests
36+
--echo #
37+

mysql-test/main/join.result

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3424,3 +3424,18 @@ COUNT(*)
34243424
2
34253425
DROP TABLE t1, t2, t3;
34263426
# End of 10.5 tests
3427+
#
3428+
# MDEV-31449: Assertion s->table->opt_range_condition_rows <= s->found_records
3429+
#
3430+
CREATE TABLE t1 (a INT, b INT);
3431+
INSERT INTO t1 VALUES (1,2),(3,4);
3432+
CREATE TABLE t2 (c INT);
3433+
INSERT INTO t2 VALUES (5),(6);
3434+
SET @tmp=@@OPTIMIZER_USE_CONDITION_SELECTIVITY, OPTIMIZER_USE_CONDITION_SELECTIVITY = 1;
3435+
SELECT * FROM
3436+
(SELECT t1.* FROM t1 WHERE t1.a IN (SELECT MAX(t2.c) FROM t2 JOIN t1)) AS sq1,
3437+
(SELECT t2.* FROM t2 JOIN t1 ON (t1.b IN (SELECT t1.b FROM t2 STRAIGHT_JOIN t1))) AS sq2;
3438+
a b c
3439+
SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp;
3440+
DROP TABLE t1,t2;
3441+
# End of 10.6 tests

mysql-test/main/join.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1835,3 +1835,22 @@ SELECT COUNT(*) FROM t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.b = t3.c) ON t1.a = t2.
18351835
DROP TABLE t1, t2, t3;
18361836

18371837
--echo # End of 10.5 tests
1838+
1839+
--echo #
1840+
--echo # MDEV-31449: Assertion s->table->opt_range_condition_rows <= s->found_records
1841+
--echo #
1842+
CREATE TABLE t1 (a INT, b INT);
1843+
INSERT INTO t1 VALUES (1,2),(3,4);
1844+
1845+
CREATE TABLE t2 (c INT);
1846+
INSERT INTO t2 VALUES (5),(6);
1847+
1848+
SET @tmp=@@OPTIMIZER_USE_CONDITION_SELECTIVITY, OPTIMIZER_USE_CONDITION_SELECTIVITY = 1;
1849+
1850+
SELECT * FROM
1851+
(SELECT t1.* FROM t1 WHERE t1.a IN (SELECT MAX(t2.c) FROM t2 JOIN t1)) AS sq1,
1852+
(SELECT t2.* FROM t2 JOIN t1 ON (t1.b IN (SELECT t1.b FROM t2 STRAIGHT_JOIN t1))) AS sq2;
1853+
1854+
SET OPTIMIZER_USE_CONDITION_SELECTIVITY=@tmp;
1855+
DROP TABLE t1,t2;
1856+
--echo # End of 10.6 tests

sql/multi_range_read.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,9 @@ bool DsMrr_impl::get_disk_sweep_mrr_cost(uint keynr, ha_rows rows, uint flags,
20082008
/* Total cost of all index accesses */
20092009
index_read_cost= primary_file->keyread_time(keynr, 1, rows);
20102010
cost->add_io(index_read_cost, 1 /* Random seeks */);
2011+
2012+
cost->cpu_cost+= (rows2double(rows) / TIME_FOR_COMPARE +
2013+
MULTI_RANGE_READ_SETUP_COST);
20112014
return FALSE;
20122015
}
20132016

sql/sql_priv.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
/* The rest of the file is included in the server only */
191191
#ifndef MYSQL_CLIENT
192192

193-
/* @@optimizer_switch flags. These must be in sync with optimizer_switch_typelib */
193+
/* @@optimizer_switch flags. These must be in sync with optimizer_switch_names */
194194
#define OPTIMIZER_SWITCH_INDEX_MERGE (1ULL << 0)
195195
#define OPTIMIZER_SWITCH_INDEX_MERGE_UNION (1ULL << 1)
196196
#define OPTIMIZER_SWITCH_INDEX_MERGE_SORT_UNION (1ULL << 2)

sql/sql_select.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5799,7 +5799,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
57995799
get_delayed_table_estimates(s->table, &s->records, &s->read_time,
58005800
&s->startup_cost);
58015801
s->found_records= s->records;
5802-
table->opt_range_condition_rows=s->records;
5802+
s->table->opt_range_condition_rows=s->records;
58035803
}
58045804
else
58055805
s->scan_time();

storage/innobase/include/fil0fil.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1655,9 +1655,11 @@ template<bool have_reference> inline void fil_space_t::flush()
16551655
flush_low();
16561656
else
16571657
{
1658-
if (!(acquire_low() & (STOPPING | CLOSING)))
1658+
if (!(acquire_low(STOPPING | CLOSING) & (STOPPING | CLOSING)))
1659+
{
16591660
flush_low();
1660-
release();
1661+
release();
1662+
}
16611663
}
16621664
}
16631665

0 commit comments

Comments
 (0)