Skip to content

Commit 3108159

Browse files
committed
Merge branch '11.0' into 10.1
2 parents b0026e3 + 3a4242f commit 3108159

File tree

250 files changed

+4958
-194807
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+4958
-194807
lines changed

mysql-test/extra/rpl_tests/rpl_foreign_key.test

Lines changed: 0 additions & 60 deletions
This file was deleted.

mysql-test/mysql-test-run.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1447,7 +1447,7 @@ sub command_line_setup {
14471447

14481448
foreach my $fs (@tmpfs_locations)
14491449
{
1450-
if ( -d $fs && ! -l $fs )
1450+
if ( -d $fs && ! -l $fs && -w $fs )
14511451
{
14521452
my $template= "var_${opt_build_thread}_XXXX";
14531453
$opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0);

mysql-test/r/gis.result

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,22 @@ c2
17331733
DROP TABLE t1;
17341734
SET optimizer_switch=@save_optimizer_switch;
17351735
#
1736+
# MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with
1737+
# optimizer_use_condition_selectivity>=3
1738+
#
1739+
CREATE TABLE t1 (a POINT);
1740+
INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3));
1741+
set @save_use_stat_tables= @@use_stat_tables;
1742+
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
1743+
set @@use_stat_tables= PREFERABLY;
1744+
set @@optimizer_use_condition_selectivity=3;
1745+
SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1');
1746+
COUNT(*)
1747+
0
1748+
set @@use_stat_tables= @save_use_stat_tables;
1749+
set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
1750+
drop table t1;
1751+
#
17361752
# End 10.0 tests
17371753
#
17381754
SHOW CREATE TABLE information_schema.geometry_columns;

mysql-test/r/group_min_max.result

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3733,6 +3733,34 @@ id MIN(a) MAX(a)
37333733
4 2001-01-04 2001-01-04
37343734
DROP TABLE t1;
37353735
#
3736+
# MDEV-17039: Query plan changes when we use GROUP BY optimization with optimizer_use_condition_selectivity=4
3737+
# and use_stat_tables= PREFERABLY
3738+
#
3739+
CREATE TABLE t1 (a INT, b INT,c INT DEFAULT 0, INDEX (a,b));
3740+
INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
3741+
(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
3742+
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
3743+
set @save_use_stat_tables= @@use_stat_tables;
3744+
set @@optimizer_use_condition_selectivity=4;
3745+
set @@use_stat_tables=PREFERABLY;
3746+
explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a);
3747+
id select_type table type possible_keys key key_len ref rows filtered Extra
3748+
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 100.00
3749+
1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 100.00 Using index
3750+
2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by
3751+
Warnings:
3752+
Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where (`test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`)
3753+
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
3754+
set @@use_stat_tables=@save_use_stat_tables;
3755+
explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a);
3756+
id select_type table type possible_keys key key_len ref rows filtered Extra
3757+
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 100.00
3758+
1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 100.00 Using index
3759+
2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by
3760+
Warnings:
3761+
Note 1003 select `test`.`t1_outer`.`a` AS `a` from <materialize> (select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where (`test`.`t1_outer`.`a` = `<subquery2>`.`max(b)`)
3762+
drop table t1;
3763+
#
37363764
# End of 10.0 tests
37373765
#
37383766
#

mysql-test/r/join.result

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,11 +1519,13 @@ ERROR 42S22: Unknown column 'f' in 'from clause'
15191519
DROP TABLE t;
15201520
CREATE TABLE t (f INT);
15211521
CALL p;
1522-
ERROR 42S22: Unknown column 'f' in 'from clause'
1522+
f
15231523
DROP TABLE t;
15241524
CREATE TABLE t (i INT);
15251525
CALL p;
1526-
ERROR 42S22: Unknown column 'f' in 'from clause'
1526+
ERROR 42S22: Unknown column 't1.f' in 'field list'
1527+
CALL p;
1528+
ERROR 42S22: Unknown column 't1.f' in 'field list'
15271529
DROP PROCEDURE p;
15281530
DROP TABLE t;
15291531
CREATE TABLE t1 (a INT, b INT);

mysql-test/r/selectivity.result

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -782,9 +782,9 @@ set optimizer_use_condition_selectivity=3;
782782
explain extended
783783
select * from t1 where a < 1 and a > 7;
784784
id select_type table type possible_keys key key_len ref rows filtered Extra
785-
1 SIMPLENULL NULLNULL NULL NULL NULLNULL NULL Impossible WHERE noticed after reading const tables
785+
1 SIMPLEt1 ALLNULL NULL NULL NULL8 100.00 Using where
786786
Warnings:
787-
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
787+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7))
788788
select * from t1 where a < 1 and a > 7;
789789
a
790790
drop table t1;
@@ -1595,3 +1595,43 @@ drop table t1,t0;
15951595
set histogram_size=@save_histogram_size;
15961596
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
15971597
set use_stat_tables=@save_use_stat_tables;
1598+
#
1599+
# MDEV-15306: Wrong/Unexpected result with the value
1600+
# optimizer_use_condition_selectivity set to 4
1601+
#
1602+
CREATE TABLE t1 (a INT);
1603+
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
1604+
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
1605+
BEGIN
1606+
SET @cnt := @cnt + 1;
1607+
RETURN 1;
1608+
END;|
1609+
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
1610+
set @save_use_stat_tables= @@use_stat_tables;
1611+
set @@use_stat_tables='complementary';
1612+
set @@optimizer_use_condition_selectivity=4;
1613+
SET @cnt= 0;
1614+
SELECT * FROM t1 WHERE a = f1();
1615+
a
1616+
1
1617+
SELECT @cnt;
1618+
@cnt
1619+
1
1620+
set @@use_stat_tables='preferably';
1621+
analyze table t1 persistent for all;
1622+
Table Op Msg_type Msg_text
1623+
test.t1 analyze status Engine-independent statistics collected
1624+
test.t1 analyze status OK
1625+
SET @cnt := 0;
1626+
set @@optimizer_use_condition_selectivity=4;
1627+
SELECT * FROM t1 WHERE a = f1();
1628+
a
1629+
1
1630+
SELECT @cnt;
1631+
@cnt
1632+
2
1633+
alter table t1 force;
1634+
set @@use_stat_tables= @save_use_stat_tables;
1635+
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
1636+
drop table t1;
1637+
drop function f1;

mysql-test/r/selectivity_innodb.result

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,9 @@ set optimizer_use_condition_selectivity=3;
789789
explain extended
790790
select * from t1 where a < 1 and a > 7;
791791
id select_type table type possible_keys key key_len ref rows filtered Extra
792-
1 SIMPLENULL NULLNULL NULL NULL NULLNULL NULL Impossible WHERE noticed after reading const tables
792+
1 SIMPLEt1 ALLNULL NULL NULL NULL8 100.00 Using where
793793
Warnings:
794-
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0
794+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` < 1) and (`test`.`t1`.`a` > 7))
795795
select * from t1 where a < 1 and a > 7;
796796
a
797797
drop table t1;
@@ -1605,6 +1605,46 @@ drop table t1,t0;
16051605
set histogram_size=@save_histogram_size;
16061606
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
16071607
set use_stat_tables=@save_use_stat_tables;
1608+
#
1609+
# MDEV-15306: Wrong/Unexpected result with the value
1610+
# optimizer_use_condition_selectivity set to 4
1611+
#
1612+
CREATE TABLE t1 (a INT);
1613+
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
1614+
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC
1615+
BEGIN
1616+
SET @cnt := @cnt + 1;
1617+
RETURN 1;
1618+
END;|
1619+
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
1620+
set @save_use_stat_tables= @@use_stat_tables;
1621+
set @@use_stat_tables='complementary';
1622+
set @@optimizer_use_condition_selectivity=4;
1623+
SET @cnt= 0;
1624+
SELECT * FROM t1 WHERE a = f1();
1625+
a
1626+
1
1627+
SELECT @cnt;
1628+
@cnt
1629+
1
1630+
set @@use_stat_tables='preferably';
1631+
analyze table t1 persistent for all;
1632+
Table Op Msg_type Msg_text
1633+
test.t1 analyze status Engine-independent statistics collected
1634+
test.t1 analyze status OK
1635+
SET @cnt := 0;
1636+
set @@optimizer_use_condition_selectivity=4;
1637+
SELECT * FROM t1 WHERE a = f1();
1638+
a
1639+
1
1640+
SELECT @cnt;
1641+
@cnt
1642+
2
1643+
alter table t1 force;
1644+
set @@use_stat_tables= @save_use_stat_tables;
1645+
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
1646+
drop table t1;
1647+
drop function f1;
16081648
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
16091649
set @tmp_ust= @@use_stat_tables;
16101650
set @tmp_oucs= @@optimizer_use_condition_selectivity;

mysql-test/r/sp.result

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7901,6 +7901,23 @@ SET S.CLOSE_YN = ''
79017901
where 1=1;
79027902
drop function if exists f1;
79037903
drop table t1,t2;
7904+
#
7905+
# MDEV-16957: Server crashes in Field_iterator_natural_join::next
7906+
# upon 2nd execution of SP
7907+
#
7908+
CREATE TABLE t1 (a INT, b VARCHAR(32));
7909+
CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c);
7910+
CALL sp;
7911+
ERROR 42S22: Unknown column 'c' in 'from clause'
7912+
CALL sp;
7913+
ERROR 42S22: Unknown column 'c' in 'from clause'
7914+
CALL sp;
7915+
ERROR 42S22: Unknown column 'c' in 'from clause'
7916+
alter table t1 add column c int;
7917+
CALL sp;
7918+
c a b a b
7919+
DROP PROCEDURE sp;
7920+
DROP TABLE t1;
79047921
# End of 5.5 test
79057922
#
79067923
# MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2

mysql-test/r/stat_tables.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,19 @@ db_name table_name column_name min_value max_value nulls_ratio avg_length avg_fr
578578
DROP TABLE t1;
579579
set use_stat_tables=@save_use_stat_tables;
580580
#
581+
# MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4
582+
#
583+
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
584+
set @@optimizer_use_condition_selectivity=4;
585+
set @@use_stat_tables= PREFERABLY;
586+
explain
587+
SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user;
588+
id select_type table type possible_keys key key_len ref rows Extra
589+
1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL
590+
1 SIMPLE user ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
591+
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
592+
set use_stat_tables=@save_use_stat_tables;
593+
#
581594
# MDEV-16757: manual addition of min/max statistics for BLOB
582595
#
583596
SET use_stat_tables= PREFERABLY;

mysql-test/r/stat_tables_innodb.result

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,19 @@ db_name table_name column_name min_value max_value nulls_ratio avg_length avg_fr
605605
DROP TABLE t1;
606606
set use_stat_tables=@save_use_stat_tables;
607607
#
608+
# MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4
609+
#
610+
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
611+
set @@optimizer_use_condition_selectivity=4;
612+
set @@use_stat_tables= PREFERABLY;
613+
explain
614+
SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user;
615+
id select_type table type possible_keys key key_len ref rows Extra
616+
1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL
617+
1 SIMPLE user ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join)
618+
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
619+
set use_stat_tables=@save_use_stat_tables;
620+
#
608621
# MDEV-16757: manual addition of min/max statistics for BLOB
609622
#
610623
SET use_stat_tables= PREFERABLY;

0 commit comments

Comments
 (0)