Skip to content

Commit

Permalink
Merge 10.9 into 10.10
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Jun 8, 2023
2 parents 886a7ce + 5b37d58 commit e704a13
Show file tree
Hide file tree
Showing 40 changed files with 491 additions and 137 deletions.
1 change: 1 addition & 0 deletions debian/mariadb-test.install
Expand Up @@ -26,6 +26,7 @@ usr/lib/mysql/plugin/qa_auth_interface.so
usr/lib/mysql/plugin/qa_auth_server.so
usr/lib/mysql/plugin/test_sql_service.so
usr/lib/mysql/plugin/test_versioning.so
usr/lib/mysql/plugin/type_mysql_timestamp.so
usr/share/man/man1/mariadb-client-test-embedded.1
usr/share/man/man1/mariadb-client-test.1
usr/share/man/man1/mariadb-test-embedded.1
Expand Down
8 changes: 4 additions & 4 deletions mysql-test/main/create_w_max_indexes_128.result
Expand Up @@ -470,7 +470,7 @@ t1 CREATE TABLE `t1` (
KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
flush tables;
show create table t1;
Table Create Table
Expand Down Expand Up @@ -619,7 +619,7 @@ t1 CREATE TABLE `t1` (
KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int,
c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int);
Expand Down Expand Up @@ -1092,7 +1092,7 @@ t1 CREATE TABLE `t1` (
KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
flush tables;
show create table t1;
Table Create Table
Expand Down Expand Up @@ -1241,7 +1241,7 @@ t1 CREATE TABLE `t1` (
KEY `a126_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a127_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
KEY `a128_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
alter table t1 add key
a129_long_123456789_123456789_123456789_123456789_123456789_1234 (
c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
Expand Down
94 changes: 94 additions & 0 deletions mysql-test/main/derived_cond_pushdown.result
Expand Up @@ -20787,6 +20787,100 @@ a
deallocate prepare stmt;
drop view v1;
drop table t1;
#
# MDEV-31240: condition pushed into splittable derived has reference to
# outer column and does not refer to any column of embedding
# select
#
create table t1 (a int);
insert into t1 select seq from seq_1_to_1000;
create table t2 (a int, b int, key (a));
insert into t2 select mod(seq,100), rand(13) * mod(seq,500) from seq_1_to_1000;
create table t3 (a int);
insert into t3 values (3), (1);
analyze table t1, t2, t3 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
explain select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 2
3 LATERAL DERIVED t2 ref a a 5 test.t1.a 10
select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
a ( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
1 1=804
2 1=1056
3 1=846
4 1=947
5 1=973
truncate table t2;
insert into t2 select mod(seq,10), rand(15) * mod(seq,500) from seq_1_to_1000;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
explain select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 100
3 DERIVED t2 ALL a NULL NULL NULL 1000 Using temporary; Using filesort
select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
a ( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
1 1=11858
2 1=11380
3 1=11588
4 1=11373
5 1=11612
drop table t1,t2,t3;
# End of 10.4 tests
#
# MDEV-28958: condition pushable into view after simplification
Expand Down
41 changes: 41 additions & 0 deletions mysql-test/main/derived_cond_pushdown.test
Expand Up @@ -3973,6 +3973,47 @@ deallocate prepare stmt;
drop view v1;
drop table t1;

--echo #
--echo # MDEV-31240: condition pushed into splittable derived has reference to
--echo # outer column and does not refer to any column of embedding
--echo # select
--echo #

create table t1 (a int);
insert into t1 select seq from seq_1_to_1000;

create table t2 (a int, b int, key (a));
insert into t2 select mod(seq,100), rand(13) * mod(seq,500) from seq_1_to_1000;

create table t3 (a int);
insert into t3 values (3), (1);

analyze table t1, t2, t3 persistent for all;

let $q=
select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;

eval explain $q;
eval $q;

truncate table t2;
insert into t2 select mod(seq,10), rand(15) * mod(seq,500) from seq_1_to_1000;

analyze table t2 persistent for all;

eval explain $q;
eval $q;

drop table t1,t2,t3;

--echo # End of 10.4 tests

--echo #
Expand Down
15 changes: 15 additions & 0 deletions mysql-test/main/derived_split_innodb.result
Expand Up @@ -839,5 +839,20 @@ SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id=
a
set optimizer_switch= @tmp1, join_cache_level= @tmp2;
DROP TABLE t1, t2;
#
# MDEV-31403: Server crashes in st_join_table::choose_best_splitting (still)
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (100),(200);
CREATE TABLE t3 (c INT, d INT, KEY(c)) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1,1),(2,2);
CREATE VIEW v AS SELECT c, d FROM t3 GROUP BY c, d;
SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
a b
DROP VIEW v;
DROP TABLE t1, t2, t3;
# End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;
21 changes: 21 additions & 0 deletions mysql-test/main/derived_split_innodb.test
Expand Up @@ -466,6 +466,27 @@ set optimizer_switch= @tmp1, join_cache_level= @tmp2;
# Cleanup
DROP TABLE t1, t2;

--echo #
--echo # MDEV-31403: Server crashes in st_join_table::choose_best_splitting (still)
--echo #
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);

CREATE TABLE t2 (b INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (100),(200);

CREATE TABLE t3 (c INT, d INT, KEY(c)) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1,1),(2,2);

CREATE VIEW v AS SELECT c, d FROM t3 GROUP BY c, d;

SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);

# Cleanup
DROP VIEW v;
DROP TABLE t1, t2, t3;

--echo # End of 10.4 tests

SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;
19 changes: 19 additions & 0 deletions mysql-test/main/explain_non_select.result
Expand Up @@ -277,3 +277,22 @@ EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2
drop table t1,t2;
#
# MDEV-31224: EXPLAIN EXTENDED for multi-table update of system table
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (3);
EXPLAIN EXTENDED UPDATE t1, t2 SET b = 4 WHERE a IN (6,2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 update `test`.`t1` set `test`.`t2`.`b` = 4 where `test`.`t1`.`a` in (6,2)
UPDATE t1, t2 SET b = 4 WHERE a IN (6,2);
SELECT * from t2;
b
4
DROP TABLE t1, t2;
# End of 10.4 tests
20 changes: 20 additions & 0 deletions mysql-test/main/explain_non_select.test
Expand Up @@ -250,3 +250,23 @@ PREPARE stmt FROM 'EXPLAIN INSERT INTO t1 SELECT * FROM t2';
EXECUTE stmt;
drop table t1,t2;

--echo #
--echo # MDEV-31224: EXPLAIN EXTENDED for multi-table update of system table
--echo #

CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);

CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (3);

let $q=
UPDATE t1, t2 SET b = 4 WHERE a IN (6,2);

eval EXPLAIN EXTENDED $q;
eval $q;
SELECT * from t2;

DROP TABLE t1, t2;

--echo # End of 10.4 tests
24 changes: 24 additions & 0 deletions mysql-test/main/group_min_max.result
Expand Up @@ -4204,6 +4204,30 @@ a b s1
2 2 t2:t2a-null;min_t3_b:t3b-null
3 3 t2:1;min_t3_b:3
drop table t1,t2,t3;
#
# MDEV-31380: Assertion `s->table->opt_range_condition_rows <= s->found_records' failed
# (assertion in 10.6+, DBL_MAX costs in 10.5)
#
CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a), KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_100;
SET
@tmp=@@optimizer_use_condition_selectivity,
optimizer_use_condition_selectivity = 1,
@tmp2=@@optimizer_trace,
optimizer_trace=1;
SELECT DISTINCT * FROM t1 WHERE a IN (1, 2);
a b
1 1
2 2
select
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100
from information_schema.optimizer_trace;
CAST(json_value(json_extract(trace, '$**.chosen_access_method.cost'), '$[0]')
as DOUBLE) < 1.0e100
1
set optimizer_use_condition_selectivity = @tmp, optimizer_trace=@tmp2;
drop table t1;
#
# End of 10.5 tests
#
Expand Down
25 changes: 25 additions & 0 deletions mysql-test/main/group_min_max.test
Expand Up @@ -7,6 +7,7 @@
--source include/default_optimizer_switch.inc
--source include/have_sequence.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
#
# TODO:
# Add queries with:
Expand Down Expand Up @@ -1859,6 +1860,30 @@ from t1;

drop table t1,t2,t3;

--echo #
--echo # MDEV-31380: Assertion `s->table->opt_range_condition_rows <= s->found_records' failed
--echo # (assertion in 10.6+, DBL_MAX costs in 10.5)
--echo #

CREATE TABLE t1 (a INT, b INT, PRIMARY KEY(a), KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_100;

SET
@tmp=@@optimizer_use_condition_selectivity,
optimizer_use_condition_selectivity = 1,
@tmp2=@@optimizer_trace,
optimizer_trace=1;

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
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 #
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/main/myisam_explain_non_select_all.result
Expand Up @@ -2689,7 +2689,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 update `test`.`t1` set NULL = 10
Note 1003 update `test`.`t1` set `test`.`t2`.`c2` = 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 7
Expand Down Expand Up @@ -2734,7 +2734,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 update `test`.`t1` set NULL = 10 where `test`.`t1`.`c3` = 10
Note 1003 update `test`.`t1` set `test`.`t2`.`c2` = 10 where `test`.`t1`.`c3` = 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 7
Expand Down

0 comments on commit e704a13

Please sign in to comment.