Skip to content

Commit

Permalink
Merge branch '10.5' into 10.6
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed May 3, 2023
2 parents fe89df4 + 69932b6 commit 043d69b
Show file tree
Hide file tree
Showing 355 changed files with 1,485 additions and 759 deletions.
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_file.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_idle.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2022, Oracle and/or its affiliates
/* Copyright (c) 2011, 2023, Oracle and/or its affiliates
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_mdl.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2012, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_memory.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2012, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_ps.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2014, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2014, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_socket.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_sp.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2013, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2013, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_stage.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_statement.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_table.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_thread.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
Copyright (c) 2020, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/mysql_transaction.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2013, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2013, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_abi_v0.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2011, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_abi_v1.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_abi_v2.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_base.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/psi/psi_memory.h
@@ -1,4 +1,4 @@
/* Copyright (c) 2013, 2022, Oracle and/or its affiliates.
/* Copyright (c) 2013, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
Expand Down
2 changes: 1 addition & 1 deletion libmariadb
14 changes: 14 additions & 0 deletions mysql-test/main/distinct.result
Expand Up @@ -1093,6 +1093,7 @@ sum(distinct 1) sum(t1.d) > 5 c
1 1 0
1 0 5
1 1 6
SET @sort_buffer_size_save= @@sort_buffer_size;
set @@sort_buffer_size=1024;
insert into t1 select -seq,-seq from seq_1_to_100;
select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ;
Expand All @@ -1106,6 +1107,19 @@ sum(distinct 1) sum(t1.d) > 2 length(group_concat(t1.d)) > 1000 c
1 1 0 5
1 1 0 6
drop table t1;
set @@sort_buffer_size=@sort_buffer_size_save;
#
# MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key
# with DISTINCT and group function
#
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
SELECT DISTINCT CONVERT(STDDEV(f), CHAR(16)) AS f1, UUID() AS f2 FROM t GROUP BY f2 WITH ROLLUP;
f1 f2
0.0000 #
0.0000 #
0.5000 #
DROP TABLE t;
# End of 10.4 tests
#
# MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN
Expand Down
13 changes: 13 additions & 0 deletions mysql-test/main/distinct.test
Expand Up @@ -834,11 +834,24 @@ select distinct sum(distinct 1), sum(t1.d) > 5 from (t1 e join t1) group by t1.c
select distinct sum(distinct 1), sum(t1.d) > 5, t1.c from (t1 e join t1) group by t1.c;

# Force usage of remove_dup_with_compare() algorithm
SET @sort_buffer_size_save= @@sort_buffer_size;
set @@sort_buffer_size=1024;
insert into t1 select -seq,-seq from seq_1_to_100;
select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ;
select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000,t1.c from (t1 e join t1) group by t1.c having t1.c > -2;
drop table t1;
set @@sort_buffer_size=@sort_buffer_size_save;

--echo #
--echo # MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key
--echo # with DISTINCT and group function
--echo #

CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
--replace_column 2 #
SELECT DISTINCT CONVERT(STDDEV(f), CHAR(16)) AS f1, UUID() AS f2 FROM t GROUP BY f2 WITH ROLLUP;
DROP TABLE t;

--echo # End of 10.4 tests

Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/insert_innodb.result
Expand Up @@ -51,7 +51,7 @@ CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNI
ERROR HY000: Field 'v1' doesn't have a default value
CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb
REPLACE SELECT NULL AS a;
ERROR HY000: Field 'DB_ROW_HASH_1' doesn't have a default value
ERROR 23000: CONSTRAINT `t1.i` failed for `test`.`t1`
#
# End of 10.5 tests
#
2 changes: 1 addition & 1 deletion mysql-test/main/insert_innodb.test
Expand Up @@ -71,7 +71,7 @@ DROP TABLE t2, t1;
--error ER_NO_DEFAULT_FOR_FIELD
CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ;

--error ER_NO_DEFAULT_FOR_FIELD
--error ER_CONSTRAINT_FAILED
CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb
REPLACE SELECT NULL AS a;

Expand Down
6 changes: 6 additions & 0 deletions mysql-test/main/long_unique_bugs.result
Expand Up @@ -451,6 +451,12 @@ a b
1 xxx
drop table t1;
#
# MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
#
create table t1 (f text not null, unique (f));
insert into t1 (f) select 'f';
drop table t1;
#
# End of 10.4 tests
#
#
Expand Down
7 changes: 7 additions & 0 deletions mysql-test/main/long_unique_bugs.test
Expand Up @@ -443,6 +443,13 @@ insert into t1 (a,b) select 1,'xxx' from seq_1_to_5;
select * from t1;
drop table t1;

--echo #
--echo # MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
--echo #
create table t1 (f text not null, unique (f));
insert into t1 (f) select 'f';
drop table t1;

--echo #
--echo # End of 10.4 tests
--echo #
Expand Down
77 changes: 73 additions & 4 deletions mysql-test/main/selectivity.result
Expand Up @@ -834,7 +834,7 @@ flush table t1;
set optimizer_use_condition_selectivity=4;
explain extended select * from t1 where a=0;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.78 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
drop table t1;
Expand Down Expand Up @@ -1649,7 +1649,7 @@ test.t1 analyze status Table is already up to date
# Check what info the optimizer has about selectivities
explain extended select * from t1 use index () where a in (17,51,5);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 3.90 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 1000 3.91 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` USE INDEX () where `test`.`t1`.`a` in (17,51,5)
explain extended select * from t1 use index () where b=2;
Expand Down Expand Up @@ -1941,9 +1941,78 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
DROP TABLE t1;
# End of 10.2 tests
#
# MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
#
create table t0(a int);
insert into t0 select 1 from seq_1_to_78;
create table t1(a int);
insert into t1 select 1 from seq_1_to_26;
create table t10 (a int);
insert into t10 select 0 from t0, seq_1_to_4;
insert into t10 select 8693 from t1;
insert into t10 select 8694 from t1;
insert into t10 select 8695 from t1;
insert into t10 select 34783 from t1;
insert into t10 select 34784 from t1;
insert into t10 select 34785 from t1;
insert into t10 select 34785 from t0, seq_1_to_8;
insert into t10 select 65214 from t1;
insert into t10 select 65215 from t1;
insert into t10 select 65216 from t1;
insert into t10 select 65216 from t0, seq_1_to_52;
insert into t10 select 65217 from t1;
insert into t10 select 65218 from t1;
insert into t10 select 65219 from t1;
insert into t10 select 65219 from t0;
insert into t10 select 73913 from t1;
insert into t10 select 73914 from t1;
insert into t10 select 73915 from t1;
insert into t10 select 73915 from t0, seq_1_to_40;
insert into t10 select 78257 from t1;
insert into t10 select 78258 from t1;
insert into t10 select 78259 from t1;
insert into t10 select 91300 from t1;
insert into t10 select 91301 from t1;
insert into t10 select 91302 from t1;
insert into t10 select 91302 from t0, seq_1_to_6;
insert into t10 select 91303 from t1;
insert into t10 select 91304 from t1;
insert into t10 select 91305 from t1;
insert into t10 select 91305 from t0, seq_1_to_8;
insert into t10 select 99998 from t1;
insert into t10 select 99999 from t1;
insert into t10 select 100000 from t1;
set use_stat_tables=preferably;
analyze table t10 persistent for all;
Table Op Msg_type Msg_text
test.t10 analyze status Engine-independent statistics collected
test.t10 analyze status OK
flush tables;
set @tmp=@@optimizer_trace;
set optimizer_trace=1;
explain select * from t10 where a in (91303);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t10 ALL NULL NULL NULL NULL 9984 Using where
# Must have selectivity_from_histogram <= 1.0:
select json_detailed(json_extract(trace, '$**.selectivity_for_columns'))
from information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.selectivity_for_columns'))
[
[
{
"column_name": "a",
"ranges":
["91303 <= a <= 91303"],
"selectivity_from_histogram": 0.035714283
}
]
]
set optimizer_trace=@tmp;
drop table t0,t1,t10;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables;
DROP TABLE t1;
# End of 10.2 tests
set @@global.histogram_size=@save_histogram_size;

0 comments on commit 043d69b

Please sign in to comment.