mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
Merge branch '10.5' into 10.6
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Submodule libmariadb updated: 374f0eedc2...c2b322d2ca
@@ -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 ;
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
#
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
#
|
||||
#
|
||||
|
||||
@@ -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 #
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -1321,14 +1321,93 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||
FLUSH TABLES;
|
||||
|
||||
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
|
||||
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;
|
||||
|
||||
--echo # End of 10.2 tests
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
|
||||
--echo #
|
||||
create table t0(a int); # This holds how many rows we hold in a bucket.
|
||||
insert into t0 select 1 from seq_1_to_78;
|
||||
|
||||
create table t1(a int); # one-third of a bucket
|
||||
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; # Only 1/3rd of bucket matches the search tuple
|
||||
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;
|
||||
flush tables;
|
||||
|
||||
set @tmp=@@optimizer_trace;
|
||||
set optimizer_trace=1;
|
||||
explain select * from t10 where a in (91303);
|
||||
|
||||
--echo # Must have selectivity_from_histogram <= 1.0:
|
||||
select json_detailed(json_extract(trace, '$**.selectivity_for_columns'))
|
||||
from information_schema.optimizer_trace;
|
||||
|
||||
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;
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
|
||||
@@ -845,7 +845,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;
|
||||
@@ -1661,7 +1661,7 @@ test.t1 analyze status OK
|
||||
# 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;
|
||||
@@ -1953,11 +1953,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 statement optimizer_trace=1 for
|
||||
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
|
||||
}
|
||||
]
|
||||
]
|
||||
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;
|
||||
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
|
||||
set @tmp_ust= @@use_stat_tables;
|
||||
|
||||
@@ -36,12 +36,12 @@ test.t2 analyze status OK
|
||||
# The following two must have the same in 'Extra' column:
|
||||
explain extended select * from t2 where col1 IN (20, 180);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (20,180)
|
||||
explain extended select * from t2 where col1 IN (180, 20);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.00 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (180,20)
|
||||
drop table t1, t2;
|
||||
@@ -102,7 +102,7 @@ test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
explain extended select * from t1 where col1 in (1,2,3);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 3.37 Using where
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 2.97 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (1,2,3)
|
||||
# Must not cause fp division by zero, or produce nonsense numbers:
|
||||
|
||||
BIN
mysql-test/std_data/rpl/master-bin-seq_10.3.36.000001
Normal file
BIN
mysql-test/std_data/rpl/master-bin-seq_10.3.36.000001
Normal file
Binary file not shown.
@@ -20,17 +20,25 @@ DROP TABLE t1;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
SET SESSION wsrep_retry_autocommit = 1;
|
||||
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
|
||||
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
|
||||
INSERT INTO t1 (f1) VALUES (3);
|
||||
connection node_1a;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
|
||||
connection node_2;
|
||||
TRUNCATE TABLE t1;
|
||||
connection node_1;
|
||||
connection node_1a;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
0
|
||||
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
|
||||
connection node_1;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
1
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET GLOBAL debug_dbug = NULL;
|
||||
DROP TABLE t1;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
@@ -64,6 +72,8 @@ SET SESSION wsrep_retry_autocommit = 64;
|
||||
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
|
||||
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
|
||||
INSERT INTO t1 VALUES (5);
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
connection node_1;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
|
||||
@@ -25,6 +25,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
|
||||
|
||||
--connection node_2
|
||||
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
|
||||
--source include/wait_condition.inc
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
--connection node_1
|
||||
@@ -44,6 +46,7 @@ DROP TABLE t1;
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
|
||||
|
||||
SET SESSION wsrep_retry_autocommit = 1;
|
||||
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
|
||||
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
|
||||
--send INSERT INTO t1 (f1) VALUES (3)
|
||||
|
||||
@@ -51,14 +54,21 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
|
||||
|
||||
--connection node_2
|
||||
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
|
||||
--source include/wait_condition.inc
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
--connection node_1a
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
|
||||
SELECT COUNT(*) FROM t1;
|
||||
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
|
||||
|
||||
--connection node_1
|
||||
--error 0,ER_LOCK_DEADLOCK
|
||||
--reap
|
||||
SELECT COUNT(*) FROM t1;
|
||||
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
SET GLOBAL debug_dbug = NULL;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
@@ -79,6 +89,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
|
||||
|
||||
--connection node_2
|
||||
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
|
||||
--source include/wait_condition.inc
|
||||
TRUNCATE TABLE t1;
|
||||
|
||||
--connection node_1a
|
||||
@@ -114,6 +126,11 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
|
||||
|
||||
--send INSERT INTO t1 VALUES (5)
|
||||
|
||||
--connection node_2
|
||||
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--connection node_1
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--let $count = 64
|
||||
|
||||
15
mysql-test/suite/galera_sr/r/MDEV-30838.result
Normal file
15
mysql-test/suite/galera_sr/r/MDEV-30838.result
Normal file
@@ -0,0 +1,15 @@
|
||||
connection node_2;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
|
||||
SET SESSION wsrep_trx_fragment_size=1;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
|
||||
INSERT INTO t1 VALUES(2);
|
||||
ERROR HY000: Error while appending streaming replication fragment
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
f1
|
||||
SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
|
||||
DROP TABLE t1;
|
||||
CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");
|
||||
18
mysql-test/suite/galera_sr/t/MDEV-30838.test
Normal file
18
mysql-test/suite/galera_sr/t/MDEV-30838.test
Normal file
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# MDEV-30838 - Assertion `m_thd == _current_thd()' failed in
|
||||
# virtual int Wsrep_client_service::bf_rollback()
|
||||
#
|
||||
--source include/galera_cluster.inc
|
||||
--source include/have_debug_sync.inc
|
||||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
|
||||
SET SESSION wsrep_trx_fragment_size=1;
|
||||
START TRANSACTION;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
|
||||
--error ER_ERROR_DURING_COMMIT
|
||||
INSERT INTO t1 VALUES(2);
|
||||
COMMIT;
|
||||
SELECT * FROM t1;
|
||||
SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
|
||||
DROP TABLE t1;
|
||||
CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");
|
||||
@@ -191,17 +191,17 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
|
||||
FROM performance_schema.events_statements_summary_by_digest
|
||||
ORDER BY DIGEST_TEXT;
|
||||
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
|
||||
test 3bcc75e0f4658692e16837ead0c455ca EXPLAIN SELECT * FROM `test` . `v1` 1
|
||||
test cc55af8221ef0bc8873e75cc704489ba EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
|
||||
test bc0498551a492bd7c0ca92906bf86fb4 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
|
||||
test 76923336b6f4ffffd0d5854761ae1aec EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
|
||||
test a65d479062ffbfe374b4cd823016a260 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
|
||||
test d44b1e50ebfd05accacef4167534ad65 SELECT * FROM `test` . `v1` 1
|
||||
test 0608cde507ef8fe35d1f68730e78f1e4 SELECT * FROM `test` . `v1` WHERE `a` = ? 1
|
||||
test 5e241fdb866faef138cc81b26203ddff SELECT * FROM `test` . `v1` WHERE `b` > ? 1
|
||||
test 74fa770ce44994b3fe7b534d504f2d6d SELECT `a` , `b` FROM `test` . `v1` 1
|
||||
test 45ca2a985d179d98395b238cf253bbe2 SELECT `b` , `a` FROM `test` . `v1` 1
|
||||
test 1cfa171590aa40ba23e14c92d6940ffc TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
|
||||
test 8b1406618d34996cd11d1796438c78b5 EXPLAIN SELECT * FROM `test` . `v1` 1
|
||||
test 2c9e5d5b30d1690ba1a625afb4c42005 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
|
||||
test 2265269dbe1b17d1f309a63b8e56933f EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
|
||||
test 2df0babfc3c8ad27b4e3f99ad59bc938 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
|
||||
test 8607297e7ffe77aa19a9d60812c5a8fd EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
|
||||
test 9c94fee7865aa050201f6e67887fd0c8 SELECT * FROM `test` . `v1` 1
|
||||
test 7c856ddf7b57d65f8124f39e8b81882e SELECT * FROM `test` . `v1` WHERE `a` = ? 1
|
||||
test 994b14d068c24edd8fd61b2f03663be2 SELECT * FROM `test` . `v1` WHERE `b` > ? 1
|
||||
test b3102e1f51878e35936d7d3fe2901839 SELECT `a` , `b` FROM `test` . `v1` 1
|
||||
test cb300dd6358987c5afe1a2b0022fdea0 SELECT `b` , `a` FROM `test` . `v1` 1
|
||||
test 1b40b63f6a9dbffd146f0916fe4f5ed2 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
|
||||
DROP TABLE test.v1;
|
||||
CREATE VIEW test.v1 AS SELECT * FROM test.t1;
|
||||
EXPLAIN SELECT * from test.v1;
|
||||
@@ -248,19 +248,19 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
|
||||
FROM performance_schema.events_statements_summary_by_digest
|
||||
ORDER BY DIGEST_TEXT;
|
||||
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
|
||||
test 630a0b16be33fcf549f4f467de557940 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
|
||||
test efa438aa8b4ddbf4c19f9e4b345781b5 DROP TABLE `test` . `v1` 1
|
||||
test 3bcc75e0f4658692e16837ead0c455ca EXPLAIN SELECT * FROM `test` . `v1` 2
|
||||
test cc55af8221ef0bc8873e75cc704489ba EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
|
||||
test bc0498551a492bd7c0ca92906bf86fb4 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
|
||||
test 76923336b6f4ffffd0d5854761ae1aec EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
|
||||
test a65d479062ffbfe374b4cd823016a260 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
|
||||
test d44b1e50ebfd05accacef4167534ad65 SELECT * FROM `test` . `v1` 2
|
||||
test 0608cde507ef8fe35d1f68730e78f1e4 SELECT * FROM `test` . `v1` WHERE `a` = ? 2
|
||||
test 5e241fdb866faef138cc81b26203ddff SELECT * FROM `test` . `v1` WHERE `b` > ? 2
|
||||
test a3788cc4bc96d260cfb5c3ebdfc65c6d SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
|
||||
test 74fa770ce44994b3fe7b534d504f2d6d SELECT `a` , `b` FROM `test` . `v1` 2
|
||||
test 45ca2a985d179d98395b238cf253bbe2 SELECT `b` , `a` FROM `test` . `v1` 2
|
||||
test 1cfa171590aa40ba23e14c92d6940ffc TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
|
||||
test a68fd555281a14d2809c3105e9cb2c90 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
|
||||
test 4baff8f96e4b6ec6cdbfef5b9c7a8b12 DROP TABLE `test` . `v1` 1
|
||||
test 8b1406618d34996cd11d1796438c78b5 EXPLAIN SELECT * FROM `test` . `v1` 2
|
||||
test 2c9e5d5b30d1690ba1a625afb4c42005 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
|
||||
test 2265269dbe1b17d1f309a63b8e56933f EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
|
||||
test 2df0babfc3c8ad27b4e3f99ad59bc938 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
|
||||
test 8607297e7ffe77aa19a9d60812c5a8fd EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
|
||||
test 9c94fee7865aa050201f6e67887fd0c8 SELECT * FROM `test` . `v1` 2
|
||||
test 7c856ddf7b57d65f8124f39e8b81882e SELECT * FROM `test` . `v1` WHERE `a` = ? 2
|
||||
test 994b14d068c24edd8fd61b2f03663be2 SELECT * FROM `test` . `v1` WHERE `b` > ? 2
|
||||
test df38ce7f6e35972efe5a4ec57e48bf4d SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
|
||||
test b3102e1f51878e35936d7d3fe2901839 SELECT `a` , `b` FROM `test` . `v1` 2
|
||||
test cb300dd6358987c5afe1a2b0022fdea0 SELECT `b` , `a` FROM `test` . `v1` 2
|
||||
test 1b40b63f6a9dbffd146f0916fe4f5ed2 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
|
||||
DROP VIEW test.v1;
|
||||
DROP TABLE test.t1;
|
||||
|
||||
@@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
|
||||
####################################
|
||||
SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
|
||||
event_name digest digest_text sql_text
|
||||
statement/sql/select 70a97f8223477a66e716cfcc317193e2 SELECT ? + ? + SELECT ...
|
||||
statement/sql/truncate ac4c7fc23914b333e9f40ce317816b8e TRUNCATE TABLE truncat...
|
||||
statement/sql/select ca9181d6d668396d467dd974f58a9402 SELECT ? + ? + SELECT ...
|
||||
statement/sql/truncate 4d2423d405bbcea8fa7bf9519c08dd8e TRUNCATE TABLE truncat...
|
||||
|
||||
85
mysql-test/suite/rpl/r/rpl_parallel_seq.result
Normal file
85
mysql-test/suite/rpl/r/rpl_parallel_seq.result
Normal file
@@ -0,0 +1,85 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
# MDEV-29621 the sequence engine binlog_row_image-full events
|
||||
# MDL-deadlock on the parallel slave.
|
||||
connection master;
|
||||
CREATE SEQUENCE s1;
|
||||
SET @@session.binlog_row_image=FULL;
|
||||
SET @@session.debug_dbug="+d,binlog_force_commit_id";
|
||||
SET @commit_id=7;
|
||||
SET @@gtid_seq_no=100;
|
||||
SELECT NEXT VALUE FOR s1;
|
||||
NEXT VALUE FOR s1
|
||||
1
|
||||
INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0);
|
||||
SET @@session.debug_dbug="";
|
||||
connection slave;
|
||||
SET @@global.slave_parallel_threads=2;
|
||||
SET @@global.slave_parallel_mode=optimistic;
|
||||
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
|
||||
include/start_slave.inc
|
||||
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
|
||||
connection master;
|
||||
DROP SEQUENCE s1;
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
# Simulate buggy 10.3.36 master to prove the parallel applier
|
||||
# does not deadlock now at replaying the above master load.
|
||||
connection master;
|
||||
include/rpl_stop_server.inc [server_number=1]
|
||||
include/rpl_start_server.inc [server_number=1]
|
||||
connection slave;
|
||||
RESET MASTER;
|
||||
SET @@global.gtid_slave_pos="";
|
||||
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos;
|
||||
START SLAVE UNTIL MASTER_GTID_POS='0-1-102';
|
||||
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
|
||||
# Normal stop is expected
|
||||
include/wait_for_slave_to_stop.inc
|
||||
# MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order
|
||||
# The test proves ALTER-SEQUENCE binlogs first before the following transaction does so.
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
Warnings:
|
||||
Note 1255 Slave already has been stopped
|
||||
RESET MASTER;
|
||||
SET @@global.gtid_slave_pos="";
|
||||
SET @@global.gtid_strict_mode=1;
|
||||
connection master;
|
||||
RESET MASTER;
|
||||
CREATE TABLE ti (a INT) ENGINE=innodb;
|
||||
CREATE SEQUENCE s2 ENGINE=innodb;
|
||||
SET @@gtid_seq_no=100;
|
||||
ALTER SEQUENCE s2 restart with 1;
|
||||
INSERT INTO ti SET a=1;
|
||||
include/save_master_gtid.inc
|
||||
SELECT @@global.gtid_binlog_state "Master gtid state";
|
||||
Master gtid state
|
||||
0-1-101
|
||||
connection slave;
|
||||
include/start_slave.inc
|
||||
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both";
|
||||
@@global.gtid_binlog_state no 100,101 yet in both
|
||||
0-1-2 0-1-2
|
||||
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
|
||||
# Normal sync with master proves the fixes correct
|
||||
include/sync_with_master_gtid.inc
|
||||
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed";
|
||||
@@global.gtid_binlog_state all through 101 have been committed
|
||||
0-1-101 0-1-101
|
||||
connection slave;
|
||||
include/stop_slave.inc
|
||||
SET debug_sync = RESET;
|
||||
SET @@global.slave_parallel_threads= 0;
|
||||
SET @@global.slave_parallel_mode= optimistic;
|
||||
SET @@global.debug_dbug = "";
|
||||
SET @@global.gtid_strict_mode=0;
|
||||
include/start_slave.inc
|
||||
connection master;
|
||||
DROP SEQUENCE s2;
|
||||
DROP TABLE ti;
|
||||
connection slave;
|
||||
include/rpl_end.inc
|
||||
@@ -17,10 +17,6 @@
|
||||
# BUG#12133 master.index file keeps mysqld from starting if bin log has been moved
|
||||
# BUG#42576 Relay logs in relay-log.info&localhost-relay-bin.index not processed after move
|
||||
|
||||
source include/master-slave.inc;
|
||||
# There is no need to run this test case on all binlog format
|
||||
source include/have_binlog_format_row.inc;
|
||||
|
||||
# Since this test relies heavily on filesystem operations (like
|
||||
# moving files around, backslashes and so forth) we avoid messing
|
||||
# around with windows access violations for not cluttering the
|
||||
@@ -28,6 +24,10 @@ source include/have_binlog_format_row.inc;
|
||||
# it is not 100% compliant.
|
||||
--source include/not_windows.inc
|
||||
|
||||
source include/master-slave.inc;
|
||||
# There is no need to run this test case on all binlog format
|
||||
source include/have_binlog_format_row.inc;
|
||||
|
||||
connection master;
|
||||
--let $master_datadir= `select @@datadir`
|
||||
connection slave;
|
||||
|
||||
@@ -2,10 +2,10 @@ if (`SELECT $PS_PROTOCOL != 0`)
|
||||
{
|
||||
--skip Test temporarily disabled for ps-protocol
|
||||
}
|
||||
--source include/no_valgrind_without_big.inc
|
||||
--let $rpl_topology=1->2
|
||||
--source include/rpl_init.inc
|
||||
--source include/have_innodb.inc
|
||||
--source include/no_valgrind_without_big.inc
|
||||
|
||||
--echo *** Test normal shutdown/restart of slave server configured as a GTID slave. ***
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#
|
||||
# (iii) master and slave tables do not differ
|
||||
#
|
||||
-- source include/master-slave.inc
|
||||
-- source include/not_windows.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
SET SQL_LOG_BIN=0;
|
||||
CREATE DATABASE B37656;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--source include/no_valgrind_without_big.inc
|
||||
--source include/have_innodb.inc
|
||||
--let $rpl_topology=1->2
|
||||
--source include/rpl_init.inc
|
||||
--source include/no_valgrind_without_big.inc
|
||||
|
||||
--connection server_2
|
||||
call mtr.add_suppression("The automatically created table.*name may not be entirely in lowercase");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
--source include/not_windows.inc #unix shell escaping used for mysqlbinlog
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_binlog_format_statement.inc
|
||||
--source include/master-slave.inc
|
||||
--source include/not_windows.inc #unix shell escaping used for mysqlbinlog
|
||||
|
||||
# MDEV-382: multiple SQL injections in replication code.
|
||||
|
||||
|
||||
131
mysql-test/suite/rpl/t/rpl_parallel_seq.test
Normal file
131
mysql-test/suite/rpl/t/rpl_parallel_seq.test
Normal file
@@ -0,0 +1,131 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/have_binlog_format_row.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
--connection slave
|
||||
--source include/stop_slave.inc
|
||||
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
|
||||
|
||||
--echo # MDEV-29621 the sequence engine binlog_row_image-full events
|
||||
--echo # MDL-deadlock on the parallel slave.
|
||||
--connection master
|
||||
CREATE SEQUENCE s1;
|
||||
SET @@session.binlog_row_image=FULL;
|
||||
SET @@session.debug_dbug="+d,binlog_force_commit_id";
|
||||
SET @commit_id=7;
|
||||
SET @@gtid_seq_no=100;
|
||||
SELECT NEXT VALUE FOR s1;
|
||||
INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0);
|
||||
SET @@session.debug_dbug="";
|
||||
|
||||
--connection slave
|
||||
--let $slave_parallel_threads=`select @@global.slave_parallel_threads`
|
||||
--let $slave_parallel_mode=`select @@global.slave_parallel_mode`
|
||||
SET @@global.slave_parallel_threads=2;
|
||||
SET @@global.slave_parallel_mode=optimistic;
|
||||
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
|
||||
--source include/start_slave.inc
|
||||
|
||||
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit"
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
|
||||
|
||||
--connection master
|
||||
DROP SEQUENCE s1;
|
||||
--sync_slave_with_master
|
||||
--source include/stop_slave.inc
|
||||
|
||||
--echo # Simulate buggy 10.3.36 master to prove the parallel applier
|
||||
--echo # does not deadlock now at replaying the above master load.
|
||||
--connection master
|
||||
--let $datadir= `SELECT @@datadir`
|
||||
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_stop_server.inc
|
||||
|
||||
--remove_file $datadir/master-bin.000001
|
||||
--copy_file $MYSQL_TEST_DIR/std_data/rpl/master-bin-seq_10.3.36.000001 $datadir/master-bin.000001
|
||||
|
||||
--let $rpl_server_number= 1
|
||||
--source include/rpl_start_server.inc
|
||||
|
||||
--source include/wait_until_connected_again.inc
|
||||
--save_master_pos
|
||||
|
||||
--connection slave
|
||||
RESET MASTER;
|
||||
SET @@global.gtid_slave_pos="";
|
||||
|
||||
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
|
||||
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos;
|
||||
|
||||
START SLAVE UNTIL MASTER_GTID_POS='0-1-102';
|
||||
|
||||
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit"
|
||||
--source include/wait_condition.inc
|
||||
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
|
||||
|
||||
--echo # Normal stop is expected
|
||||
--source include/wait_for_slave_to_stop.inc
|
||||
|
||||
--echo # MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order
|
||||
--echo # The test proves ALTER-SEQUENCE binlogs first before the following transaction does so.
|
||||
|
||||
--connection slave
|
||||
--source include/stop_slave.inc
|
||||
RESET MASTER;
|
||||
SET @@global.gtid_slave_pos="";
|
||||
--let $slave_gtid_strict_mode=`select @@global.gtid_strict_mode`
|
||||
SET @@global.gtid_strict_mode=1;
|
||||
--connection master
|
||||
RESET MASTER;
|
||||
|
||||
# Load from master
|
||||
CREATE TABLE ti (a INT) ENGINE=innodb;
|
||||
CREATE SEQUENCE s2 ENGINE=innodb;
|
||||
|
||||
SET @@gtid_seq_no=100;
|
||||
ALTER SEQUENCE s2 restart with 1;
|
||||
INSERT INTO ti SET a=1;
|
||||
--source include/save_master_gtid.inc
|
||||
SELECT @@global.gtid_binlog_state "Master gtid state";
|
||||
|
||||
--connection slave
|
||||
--source include/start_slave.inc
|
||||
|
||||
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit"
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both";
|
||||
|
||||
# DEBUG_DBUG extension point of hold_worker_on_schedule is reused
|
||||
# (gets deployed) in Sql_cmd_alter_sequence::execute.
|
||||
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
|
||||
|
||||
--echo # Normal sync with master proves the fixes correct
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed";
|
||||
|
||||
#
|
||||
# MDEV-29621/MDEV-31077 clean up.
|
||||
#
|
||||
--connection slave
|
||||
--source include/stop_slave.inc
|
||||
|
||||
SET debug_sync = RESET;
|
||||
--eval SET @@global.slave_parallel_threads= $slave_parallel_threads
|
||||
--eval SET @@global.slave_parallel_mode= $slave_parallel_mode
|
||||
SET @@global.debug_dbug = "";
|
||||
--eval SET @@global.gtid_strict_mode=$slave_gtid_strict_mode
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection master
|
||||
DROP SEQUENCE s2;
|
||||
DROP TABLE ti;
|
||||
|
||||
--sync_slave_with_master
|
||||
|
||||
--source include/rpl_end.inc
|
||||
@@ -3,10 +3,10 @@
|
||||
# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
|
||||
#
|
||||
|
||||
-- source include/master-slave.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_windows.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_row.inc
|
||||
-- source include/master-slave.inc
|
||||
|
||||
-- let $engine=InnoDB
|
||||
-- source include/rpl_lower_case_table_names.test
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
source include/no_valgrind_without_big.inc;
|
||||
source include/not_embedded.inc;
|
||||
source include/have_innodb.inc;
|
||||
source include/master-slave.inc;
|
||||
source include/no_valgrind_without_big.inc;
|
||||
|
||||
let $engine_type= InnoDB;
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
# Please check all dependent tests after modifying it
|
||||
#
|
||||
|
||||
source include/no_valgrind_without_big.inc;
|
||||
source include/have_ssl_communication.inc;
|
||||
source include/master-slave.inc;
|
||||
source include/no_valgrind_without_big.inc;
|
||||
|
||||
# create a user for replication that requires ssl encryption
|
||||
connection master;
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
# For details look into extra/rpl_tests/rpl_lower_case_table_names.test
|
||||
#
|
||||
|
||||
-- source include/not_windows.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_mixed_or_statement.inc
|
||||
-- source include/master-slave.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_windows.inc
|
||||
|
||||
-- let $engine=InnoDB
|
||||
-- source include/rpl_lower_case_table_names.test
|
||||
|
||||
@@ -250,6 +250,8 @@ int ha_sequence::write_row(const uchar *buf)
|
||||
on master and slaves
|
||||
- Check that the new row is an accurate SEQUENCE object
|
||||
*/
|
||||
/* mark a full binlog image insert to force non-parallel slave */
|
||||
thd->transaction->stmt.mark_trans_did_ddl();
|
||||
if (table->s->tmp_table == NO_TMP_TABLE &&
|
||||
thd->mdl_context.upgrade_shared_lock(table->mdl_ticket,
|
||||
MDL_EXCLUSIVE,
|
||||
|
||||
10
sql/item.cc
10
sql/item.cc
@@ -10529,7 +10529,8 @@ int Item_cache_str::save_in_field(Field *field, bool no_conversions)
|
||||
bool Item_cache_row::allocate(THD *thd, uint num)
|
||||
{
|
||||
item_count= num;
|
||||
return (!(values=
|
||||
return (!values &&
|
||||
!(values=
|
||||
(Item_cache **) thd->calloc(sizeof(Item_cache *)*item_count)));
|
||||
}
|
||||
|
||||
@@ -10565,11 +10566,12 @@ bool Item_cache_row::setup(THD *thd, Item *item)
|
||||
return 1;
|
||||
for (uint i= 0; i < item_count; i++)
|
||||
{
|
||||
Item_cache *tmp;
|
||||
Item *el= item->element_index(i);
|
||||
if (!(tmp= values[i]= el->get_cache(thd)))
|
||||
|
||||
if ((!values[i]) && !(values[i]= el->get_cache(thd)))
|
||||
return 1;
|
||||
tmp->setup(thd, el);
|
||||
|
||||
values[i]->setup(thd, el);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
10
sql/item.h
10
sql/item.h
@@ -7082,6 +7082,9 @@ public:
|
||||
}
|
||||
|
||||
virtual void keep_array() {}
|
||||
#ifndef DBUG_OFF
|
||||
bool is_array_kept() { return TRUE; }
|
||||
#endif
|
||||
void print(String *str, enum_query_type query_type) override;
|
||||
bool eq_def(const Field *field)
|
||||
{
|
||||
@@ -7570,13 +7573,14 @@ public:
|
||||
bool null_inside() override;
|
||||
void bring_value() override;
|
||||
void keep_array() override { save_array= 1; }
|
||||
#ifndef DBUG_OFF
|
||||
bool is_array_kept() { return save_array; }
|
||||
#endif
|
||||
void cleanup() override
|
||||
{
|
||||
DBUG_ENTER("Item_cache_row::cleanup");
|
||||
Item_cache::cleanup();
|
||||
if (save_array)
|
||||
bzero(values, item_count*sizeof(Item**));
|
||||
else
|
||||
if (!save_array)
|
||||
values= 0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@@ -1298,9 +1298,22 @@ bool Item_in_optimizer::fix_left(THD *thd)
|
||||
ref0= args[1]->get_IN_subquery()->left_exp_ptr();
|
||||
args[0]= (*ref0);
|
||||
}
|
||||
if ((*ref0)->fix_fields_if_needed(thd, ref0) ||
|
||||
(!cache && !(cache= (*ref0)->get_cache(thd))))
|
||||
if ((*ref0)->fix_fields_if_needed(thd, ref0))
|
||||
DBUG_RETURN(1);
|
||||
if (!cache)
|
||||
{
|
||||
Query_arena *arena, backup;
|
||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||
|
||||
bool rc= !(cache= (*ref0)->get_cache(thd));
|
||||
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
|
||||
if (rc)
|
||||
DBUG_RETURN(1);
|
||||
cache->keep_array();
|
||||
}
|
||||
/*
|
||||
During fix_field() expression could be substituted.
|
||||
So we copy changes before use
|
||||
@@ -1659,19 +1672,10 @@ longlong Item_in_optimizer::val_int()
|
||||
}
|
||||
|
||||
|
||||
void Item_in_optimizer::keep_top_level_cache()
|
||||
{
|
||||
cache->keep_array();
|
||||
save_cache= 1;
|
||||
}
|
||||
|
||||
|
||||
void Item_in_optimizer::cleanup()
|
||||
{
|
||||
DBUG_ENTER("Item_in_optimizer::cleanup");
|
||||
Item_bool_func::cleanup();
|
||||
if (!save_cache)
|
||||
cache= 0;
|
||||
expr_cache= 0;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@@ -374,8 +374,7 @@ class Item_in_optimizer: public Item_bool_func
|
||||
protected:
|
||||
Item_cache *cache;
|
||||
Item *expr_cache;
|
||||
bool save_cache;
|
||||
/*
|
||||
/*
|
||||
Stores the value of "NULL IN (SELECT ...)" for uncorrelated subqueries:
|
||||
UNKNOWN - "NULL in (SELECT ...)" has not yet been evaluated
|
||||
FALSE - result is FALSE
|
||||
@@ -385,7 +384,7 @@ protected:
|
||||
public:
|
||||
Item_in_optimizer(THD *thd, Item *a, Item *b):
|
||||
Item_bool_func(thd, a, b), cache(0), expr_cache(0),
|
||||
save_cache(0), result_for_null_param(UNKNOWN)
|
||||
result_for_null_param(UNKNOWN)
|
||||
{
|
||||
with_flags|= item_with_t::SUBQUERY;
|
||||
}
|
||||
@@ -402,7 +401,6 @@ public:
|
||||
return name;
|
||||
}
|
||||
Item_cache **get_cache() { return &cache; }
|
||||
void keep_top_level_cache();
|
||||
Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override;
|
||||
Item *expr_cache_insert_transformer(THD *thd, uchar *unused) override;
|
||||
bool is_expensive_processor(void *arg) override;
|
||||
|
||||
@@ -406,11 +406,11 @@ bool Item_subselect::mark_as_dependent(THD *thd, st_select_lex *select,
|
||||
{
|
||||
is_correlated= TRUE;
|
||||
Ref_to_outside *upper;
|
||||
if (!(upper= new (thd->stmt_arena->mem_root) Ref_to_outside()))
|
||||
if (!(upper= new (thd->mem_root) Ref_to_outside()))
|
||||
return TRUE;
|
||||
upper->select= select;
|
||||
upper->item= item;
|
||||
if (upper_refs.push_back(upper, thd->stmt_arena->mem_root))
|
||||
if (upper_refs.push_back(upper, thd->mem_root))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -2067,7 +2067,7 @@ Item_in_subselect::single_value_transformer(JOIN *join)
|
||||
thd->lex->current_select= current;
|
||||
|
||||
/* We will refer to upper level cache array => we have to save it for SP */
|
||||
optimizer->keep_top_level_cache();
|
||||
DBUG_ASSERT(optimizer->get_cache()[0]->is_array_kept());
|
||||
|
||||
/*
|
||||
As far as Item_in_optimizer does not substitute itself on fix_fields
|
||||
@@ -2464,7 +2464,7 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
||||
}
|
||||
|
||||
// we will refer to upper level cache array => we have to save it in PS
|
||||
optimizer->keep_top_level_cache();
|
||||
DBUG_ASSERT(optimizer->get_cache()[0]->is_array_kept());
|
||||
|
||||
thd->lex->current_select= current;
|
||||
/*
|
||||
|
||||
@@ -7543,8 +7543,18 @@ Rows_log_event::write_row(rpl_group_info *rgi,
|
||||
int Rows_log_event::update_sequence()
|
||||
{
|
||||
TABLE *table= m_table; // pointer to event's table
|
||||
bool old_master= false;
|
||||
int err= 0;
|
||||
|
||||
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO))
|
||||
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO) ||
|
||||
(
|
||||
#if defined(WITH_WSREP)
|
||||
! WSREP(thd) &&
|
||||
#endif
|
||||
!(table->in_use->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_DDL) &&
|
||||
!(old_master=
|
||||
rpl_master_has_bug(thd->rgi_slave->rli,
|
||||
29621, FALSE, FALSE, FALSE, TRUE))))
|
||||
{
|
||||
/* This event come from a setval function executed on the master.
|
||||
Update the sequence next_number and round, like we do with setval()
|
||||
@@ -7557,12 +7567,27 @@ int Rows_log_event::update_sequence()
|
||||
|
||||
return table->s->sequence->set_value(table, nextval, round, 0) > 0;
|
||||
}
|
||||
|
||||
if (old_master && !WSREP(thd) && thd->rgi_slave->is_parallel_exec)
|
||||
{
|
||||
DBUG_ASSERT(thd->rgi_slave->parallel_entry);
|
||||
/*
|
||||
With parallel replication enabled, we can't execute alongside any other
|
||||
transaction in which we may depend, so we force retry to release
|
||||
the server layer table lock for possible prior in binlog order
|
||||
same table transactions.
|
||||
*/
|
||||
if (thd->rgi_slave->parallel_entry->last_committed_sub_id <
|
||||
thd->rgi_slave->wait_commit_sub_id)
|
||||
{
|
||||
err= ER_LOCK_DEADLOCK;
|
||||
my_error(err, MYF(0));
|
||||
}
|
||||
}
|
||||
/*
|
||||
Update all fields in table and update the active sequence, like with
|
||||
ALTER SEQUENCE
|
||||
*/
|
||||
return table->file->ha_write_row(table->record[0]);
|
||||
return err == 0 ? table->file->ha_write_row(table->record[0]) : err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2935,7 +2935,12 @@ rpl_parallel::do_event(rpl_group_info *serial_rgi, Log_event *ev,
|
||||
|
||||
if (mode <= SLAVE_PARALLEL_MINIMAL ||
|
||||
!(gtid_flags & Gtid_log_event::FL_GROUP_COMMIT_ID) ||
|
||||
e->last_commit_id != gtid_ev->commit_id)
|
||||
e->last_commit_id != gtid_ev->commit_id ||
|
||||
/*
|
||||
MULTI_BATCH is also set when the current gtid even being a member
|
||||
of a commit group is flagged as DDL which disallows parallel.
|
||||
*/
|
||||
(gtid_flags & Gtid_log_event::FL_DDL))
|
||||
flags|= group_commit_orderer::MULTI_BATCH;
|
||||
/* Make sure we do not attempt to run DDL in parallel speculatively. */
|
||||
if (gtid_flags & Gtid_log_event::FL_DDL)
|
||||
|
||||
35
sql/slave.cc
35
sql/slave.cc
@@ -8171,14 +8171,15 @@ end:
|
||||
@return TRUE if master has the bug, FALSE if it does not.
|
||||
*/
|
||||
bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
|
||||
bool (*pred)(const void *), const void *param)
|
||||
bool (*pred)(const void *), const void *param,
|
||||
bool maria_master)
|
||||
{
|
||||
struct st_version_range_for_one_bug {
|
||||
uint bug_id;
|
||||
Version introduced_in; // first version with bug
|
||||
Version fixed_in; // first version with fix
|
||||
};
|
||||
static struct st_version_range_for_one_bug versions_for_all_bugs[]=
|
||||
static struct st_version_range_for_one_bug versions_for_their_bugs[]=
|
||||
{
|
||||
{24432, { 5, 0, 24 }, { 5, 0, 38 } },
|
||||
{24432, { 5, 1, 12 }, { 5, 1, 17 } },
|
||||
@@ -8186,11 +8187,27 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
|
||||
{33029, { 5, 1, 0 }, { 5, 1, 12 } },
|
||||
{37426, { 5, 1, 0 }, { 5, 1, 26 } },
|
||||
};
|
||||
static struct st_version_range_for_one_bug versions_for_our_bugs[]=
|
||||
{
|
||||
{29621, { 10, 3, 36 }, { 10, 3, 39 } },
|
||||
{29621, { 10, 4, 26 }, { 10, 4, 29 } },
|
||||
{29621, { 10, 5, 17 }, { 10, 5, 20 } },
|
||||
{29621, { 10, 6, 9 }, { 10, 6, 13 } },
|
||||
{29621, { 10, 7, 5 }, { 10, 7, 9 } },
|
||||
{29621, { 10, 8, 4 }, { 10, 8, 8 } },
|
||||
{29621, { 10, 9, 2 }, { 10, 9, 6 } },
|
||||
{29621, { 10, 10,1 }, { 10, 10,4 } },
|
||||
{29621, { 10, 11,1 }, { 10, 11,3 } },
|
||||
};
|
||||
const Version &master_ver=
|
||||
rli->relay_log.description_event_for_exec->server_version_split;
|
||||
struct st_version_range_for_one_bug* versions_for_all_bugs= maria_master ?
|
||||
versions_for_our_bugs : versions_for_their_bugs;
|
||||
uint all_size= maria_master ?
|
||||
sizeof(versions_for_our_bugs)/sizeof(*versions_for_our_bugs) :
|
||||
sizeof(versions_for_their_bugs)/sizeof(*versions_for_their_bugs);
|
||||
|
||||
for (uint i= 0;
|
||||
i < sizeof(versions_for_all_bugs)/sizeof(*versions_for_all_bugs);i++)
|
||||
for (uint i= 0; i < all_size; i++)
|
||||
{
|
||||
const Version &introduced_in= versions_for_all_bugs[i].introduced_in;
|
||||
const Version &fixed_in= versions_for_all_bugs[i].fixed_in;
|
||||
@@ -8199,18 +8216,21 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
|
||||
fixed_in > master_ver &&
|
||||
(pred == NULL || (*pred)(param)))
|
||||
{
|
||||
const char *bug_source= maria_master ?
|
||||
"https://jira.mariadb.org/browse/MDEV-" :
|
||||
"http://bugs.mysql.com/bug.php?id=";
|
||||
if (!report)
|
||||
return TRUE;
|
||||
// a short message for SHOW SLAVE STATUS (message length constraints)
|
||||
my_printf_error(ER_UNKNOWN_ERROR, "master may suffer from"
|
||||
" http://bugs.mysql.com/bug.php?id=%u"
|
||||
" %s%u"
|
||||
" so slave stops; check error log on slave"
|
||||
" for more info", MYF(0), bug_id);
|
||||
" for more info", MYF(0), bug_source, bug_id);
|
||||
// a verbose message for the error log
|
||||
rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR, NULL,
|
||||
"According to the master's version ('%s'),"
|
||||
" it is probable that master suffers from this bug:"
|
||||
" http://bugs.mysql.com/bug.php?id=%u"
|
||||
" %s%u"
|
||||
" and thus replicating the current binary log event"
|
||||
" may make the slave's data become different from the"
|
||||
" master's data."
|
||||
@@ -8224,6 +8244,7 @@ bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
|
||||
" equal to '%d.%d.%d'. Then replication can be"
|
||||
" restarted.",
|
||||
rli->relay_log.description_event_for_exec->server_version,
|
||||
bug_source,
|
||||
bug_id,
|
||||
fixed_in[0], fixed_in[1], fixed_in[2]);
|
||||
return TRUE;
|
||||
|
||||
@@ -231,7 +231,8 @@ bool show_all_master_info(THD* thd);
|
||||
void show_binlog_info_get_fields(THD *thd, List<Item> *field_list);
|
||||
bool show_binlog_info(THD* thd);
|
||||
bool rpl_master_has_bug(const Relay_log_info *rli, uint bug_id, bool report,
|
||||
bool (*pred)(const void *), const void *param);
|
||||
bool (*pred)(const void *), const void *param,
|
||||
bool maria_master= false);
|
||||
bool rpl_master_erroneous_autoinc(THD* thd);
|
||||
|
||||
const char *print_slave_db_safe(const char *db);
|
||||
|
||||
@@ -2223,7 +2223,7 @@ int check_that_all_fields_are_given_values(THD *thd, TABLE *entry, TABLE_LIST *t
|
||||
for (Field **field=entry->field ; *field ; field++)
|
||||
{
|
||||
if (!bitmap_is_set(write_set, (*field)->field_index) &&
|
||||
!(*field)->vers_sys_field() &&
|
||||
!(*field)->vers_sys_field() && !(*field)->vcol_info &&
|
||||
has_no_default_value(thd, *field, table_list) &&
|
||||
((*field)->real_type() != MYSQL_TYPE_ENUM))
|
||||
err=1;
|
||||
|
||||
@@ -886,7 +886,7 @@ void Lex_input_stream::body_utf8_start(THD *thd, const char *begin_ptr)
|
||||
}
|
||||
|
||||
|
||||
size_t Lex_input_stream::get_body_utf8_maximum_length(THD *thd)
|
||||
size_t Lex_input_stream::get_body_utf8_maximum_length(THD *thd) const
|
||||
{
|
||||
/*
|
||||
String literals can grow during escaping:
|
||||
@@ -1391,7 +1391,7 @@ Yacc_state::~Yacc_state()
|
||||
}
|
||||
|
||||
int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
|
||||
uint len, bool function)
|
||||
uint len, bool function) const
|
||||
{
|
||||
const char *tok= m_tok_start;
|
||||
|
||||
@@ -9380,22 +9380,6 @@ bool LEX::add_grant_command(THD *thd, const List<LEX_COLUMN> &columns)
|
||||
}
|
||||
|
||||
|
||||
Item *LEX::make_item_func_substr(THD *thd, Item *a, Item *b, Item *c)
|
||||
{
|
||||
return (thd->variables.sql_mode & MODE_ORACLE) ?
|
||||
new (thd->mem_root) Item_func_substr_oracle(thd, a, b, c) :
|
||||
new (thd->mem_root) Item_func_substr(thd, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
Item *LEX::make_item_func_substr(THD *thd, Item *a, Item *b)
|
||||
{
|
||||
return (thd->variables.sql_mode & MODE_ORACLE) ?
|
||||
new (thd->mem_root) Item_func_substr_oracle(thd, a, b) :
|
||||
new (thd->mem_root) Item_func_substr(thd, a, b);
|
||||
}
|
||||
|
||||
|
||||
Item *LEX::make_item_func_sysdate(THD *thd, uint fsp)
|
||||
{
|
||||
/*
|
||||
@@ -9416,17 +9400,6 @@ Item *LEX::make_item_func_sysdate(THD *thd, uint fsp)
|
||||
}
|
||||
|
||||
|
||||
Item *LEX::make_item_func_replace(THD *thd,
|
||||
Item *org,
|
||||
Item *find,
|
||||
Item *replace)
|
||||
{
|
||||
return (thd->variables.sql_mode & MODE_ORACLE) ?
|
||||
new (thd->mem_root) Item_func_replace_oracle(thd, org, find, replace) :
|
||||
new (thd->mem_root) Item_func_replace(thd, org, find, replace);
|
||||
}
|
||||
|
||||
|
||||
bool SELECT_LEX::vers_push_field(THD *thd, TABLE_LIST *table,
|
||||
const LEX_CSTRING field_name)
|
||||
{
|
||||
|
||||
@@ -2507,7 +2507,7 @@ private:
|
||||
Get the last character accepted.
|
||||
@return the last character accepted.
|
||||
*/
|
||||
unsigned char yyGetLast()
|
||||
unsigned char yyGetLast() const
|
||||
{
|
||||
return m_ptr[-1];
|
||||
}
|
||||
@@ -2515,7 +2515,7 @@ private:
|
||||
/**
|
||||
Look at the next character to parse, but do not accept it.
|
||||
*/
|
||||
unsigned char yyPeek()
|
||||
unsigned char yyPeek() const
|
||||
{
|
||||
return m_ptr[0];
|
||||
}
|
||||
@@ -2524,7 +2524,7 @@ private:
|
||||
Look ahead at some character to parse.
|
||||
@param n offset of the character to look up
|
||||
*/
|
||||
unsigned char yyPeekn(int n)
|
||||
unsigned char yyPeekn(int n) const
|
||||
{
|
||||
return m_ptr[n];
|
||||
}
|
||||
@@ -2585,7 +2585,7 @@ private:
|
||||
@param n number of characters expected
|
||||
@return true if there are less than n characters to parse
|
||||
*/
|
||||
bool eof(int n)
|
||||
bool eof(int n) const
|
||||
{
|
||||
return ((m_ptr + n) >= m_end_of_query);
|
||||
}
|
||||
@@ -2616,10 +2616,10 @@ private:
|
||||
Get the maximum length of the utf8-body buffer.
|
||||
The utf8 body can grow because of the character set conversion and escaping.
|
||||
*/
|
||||
size_t get_body_utf8_maximum_length(THD *thd);
|
||||
size_t get_body_utf8_maximum_length(THD *thd) const;
|
||||
|
||||
/** Get the length of the current token, in the raw buffer. */
|
||||
uint yyLength()
|
||||
uint yyLength() const
|
||||
{
|
||||
/*
|
||||
The assumption is that the lexical analyser is always 1 character ahead,
|
||||
@@ -2644,31 +2644,31 @@ public:
|
||||
End of file indicator for the query text to parse.
|
||||
@return true if there are no more characters to parse
|
||||
*/
|
||||
bool eof()
|
||||
bool eof() const
|
||||
{
|
||||
return (m_ptr >= m_end_of_query);
|
||||
}
|
||||
|
||||
/** Get the raw query buffer. */
|
||||
const char *get_buf()
|
||||
const char *get_buf() const
|
||||
{
|
||||
return m_buf;
|
||||
}
|
||||
|
||||
/** Get the pre-processed query buffer. */
|
||||
const char *get_cpp_buf()
|
||||
const char *get_cpp_buf() const
|
||||
{
|
||||
return m_cpp_buf;
|
||||
}
|
||||
|
||||
/** Get the end of the raw query buffer. */
|
||||
const char *get_end_of_query()
|
||||
const char *get_end_of_query() const
|
||||
{
|
||||
return m_end_of_query;
|
||||
}
|
||||
|
||||
/** Get the token start position, in the raw buffer. */
|
||||
const char *get_tok_start()
|
||||
const char *get_tok_start() const
|
||||
{
|
||||
return has_lookahead() ? m_tok_start_prev : m_tok_start;
|
||||
}
|
||||
@@ -2679,25 +2679,25 @@ public:
|
||||
}
|
||||
|
||||
/** Get the token end position, in the raw buffer. */
|
||||
const char *get_tok_end()
|
||||
const char *get_tok_end() const
|
||||
{
|
||||
return m_tok_end;
|
||||
}
|
||||
|
||||
/** Get the current stream pointer, in the raw buffer. */
|
||||
const char *get_ptr()
|
||||
const char *get_ptr() const
|
||||
{
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
/** Get the token start position, in the pre-processed buffer. */
|
||||
const char *get_cpp_tok_start()
|
||||
const char *get_cpp_tok_start() const
|
||||
{
|
||||
return has_lookahead() ? m_cpp_tok_start_prev : m_cpp_tok_start;
|
||||
}
|
||||
|
||||
/** Get the token end position, in the pre-processed buffer. */
|
||||
const char *get_cpp_tok_end()
|
||||
const char *get_cpp_tok_end() const
|
||||
{
|
||||
return m_cpp_tok_end;
|
||||
}
|
||||
@@ -2706,7 +2706,7 @@ public:
|
||||
Get the token end position in the pre-processed buffer,
|
||||
with trailing spaces removed.
|
||||
*/
|
||||
const char *get_cpp_tok_end_rtrim()
|
||||
const char *get_cpp_tok_end_rtrim() const
|
||||
{
|
||||
const char *p;
|
||||
for (p= m_cpp_tok_end;
|
||||
@@ -2717,7 +2717,7 @@ public:
|
||||
}
|
||||
|
||||
/** Get the current stream pointer, in the pre-processed buffer. */
|
||||
const char *get_cpp_ptr()
|
||||
const char *get_cpp_ptr() const
|
||||
{
|
||||
return m_cpp_ptr;
|
||||
}
|
||||
@@ -2726,7 +2726,7 @@ public:
|
||||
Get the current stream pointer, in the pre-processed buffer,
|
||||
with traling spaces removed.
|
||||
*/
|
||||
const char *get_cpp_ptr_rtrim()
|
||||
const char *get_cpp_ptr_rtrim() const
|
||||
{
|
||||
const char *p;
|
||||
for (p= m_cpp_ptr;
|
||||
@@ -2736,13 +2736,13 @@ public:
|
||||
return p;
|
||||
}
|
||||
/** Get the utf8-body string. */
|
||||
const char *get_body_utf8_str()
|
||||
const char *get_body_utf8_str() const
|
||||
{
|
||||
return m_body_utf8;
|
||||
}
|
||||
|
||||
/** Get the utf8-body length. */
|
||||
size_t get_body_utf8_length()
|
||||
size_t get_body_utf8_length() const
|
||||
{
|
||||
return (size_t) (m_body_utf8_ptr - m_body_utf8);
|
||||
}
|
||||
@@ -2778,7 +2778,7 @@ private:
|
||||
|
||||
bool consume_comment(int remaining_recursions_permitted);
|
||||
int lex_one_token(union YYSTYPE *yylval, THD *thd);
|
||||
int find_keyword(Lex_ident_cli_st *str, uint len, bool function);
|
||||
int find_keyword(Lex_ident_cli_st *str, uint len, bool function) const;
|
||||
LEX_CSTRING get_token(uint skip, uint length);
|
||||
int scan_ident_sysvar(THD *thd, Lex_ident_cli_st *str);
|
||||
int scan_ident_start(THD *thd, Lex_ident_cli_st *str);
|
||||
@@ -4131,9 +4131,6 @@ public:
|
||||
|
||||
Item *create_item_query_expression(THD *thd, st_select_lex_unit *unit);
|
||||
|
||||
Item *make_item_func_replace(THD *thd, Item *org, Item *find, Item *replace);
|
||||
Item *make_item_func_substr(THD *thd, Item *a, Item *b, Item *c);
|
||||
Item *make_item_func_substr(THD *thd, Item *a, Item *b);
|
||||
Item *make_item_func_sysdate(THD *thd, uint fsp);
|
||||
Item *make_item_func_call_generic(THD *thd, Lex_ident_cli_st *db,
|
||||
Lex_ident_cli_st *name, List<Item> *args);
|
||||
|
||||
@@ -32,6 +32,14 @@ public:
|
||||
return thd->type_handler_for_datetime();
|
||||
return src;
|
||||
}
|
||||
|
||||
Item *make_item_func_replace(THD *thd,
|
||||
Item *subj,
|
||||
Item *find,
|
||||
Item *replace) const;
|
||||
Item *make_item_func_substr(THD *thd,
|
||||
const Lex_substring_spec_st &spec) const;
|
||||
Item *make_item_func_trim(THD *thd, const Lex_trim_st &spec) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -78,3 +86,56 @@ Schema *Schema::find_implied(THD *thd)
|
||||
return &maxdb_schema;
|
||||
return &mariadb_schema;
|
||||
}
|
||||
|
||||
|
||||
Item *Schema::make_item_func_replace(THD *thd,
|
||||
Item *subj,
|
||||
Item *find,
|
||||
Item *replace) const
|
||||
{
|
||||
return new (thd->mem_root) Item_func_replace(thd, subj, find, replace);
|
||||
}
|
||||
|
||||
|
||||
Item *Schema::make_item_func_substr(THD *thd,
|
||||
const Lex_substring_spec_st &spec) const
|
||||
{
|
||||
return spec.m_for ?
|
||||
new (thd->mem_root) Item_func_substr(thd, spec.m_subject, spec.m_from,
|
||||
spec.m_for) :
|
||||
new (thd->mem_root) Item_func_substr(thd, spec.m_subject, spec.m_from);
|
||||
}
|
||||
|
||||
|
||||
Item *Schema::make_item_func_trim(THD *thd, const Lex_trim_st &spec) const
|
||||
{
|
||||
return spec.make_item_func_trim_std(thd);
|
||||
}
|
||||
|
||||
|
||||
Item *Schema_oracle::make_item_func_replace(THD *thd,
|
||||
Item *subj,
|
||||
Item *find,
|
||||
Item *replace) const
|
||||
{
|
||||
return new (thd->mem_root) Item_func_replace_oracle(thd, subj, find, replace);
|
||||
}
|
||||
|
||||
|
||||
Item *Schema_oracle::make_item_func_substr(THD *thd,
|
||||
const Lex_substring_spec_st &spec) const
|
||||
{
|
||||
return spec.m_for ?
|
||||
new (thd->mem_root) Item_func_substr_oracle(thd, spec.m_subject,
|
||||
spec.m_from,
|
||||
spec.m_for) :
|
||||
new (thd->mem_root) Item_func_substr_oracle(thd, spec.m_subject,
|
||||
spec.m_from);
|
||||
}
|
||||
|
||||
|
||||
Item *Schema_oracle::make_item_func_trim(THD *thd,
|
||||
const Lex_trim_st &spec) const
|
||||
{
|
||||
return spec.make_item_func_trim_oracle(thd);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,17 @@ public:
|
||||
{
|
||||
return src;
|
||||
}
|
||||
|
||||
// Builders for native SQL function with a special syntax in sql_yacc.yy
|
||||
virtual Item *make_item_func_replace(THD *thd,
|
||||
Item *subj,
|
||||
Item *find,
|
||||
Item *replace) const;
|
||||
virtual Item *make_item_func_substr(THD *thd,
|
||||
const Lex_substring_spec_st &spec) const;
|
||||
|
||||
virtual Item *make_item_func_trim(THD *thd, const Lex_trim_st &spec) const;
|
||||
|
||||
/*
|
||||
For now we have *hard-coded* compatibility schemas:
|
||||
schema_mariadb, schema_oracle, schema_maxdb.
|
||||
|
||||
@@ -25067,7 +25067,7 @@ JOIN_TAB::remove_duplicates()
|
||||
if (!(sortorder= (SORT_FIELD*) my_malloc(PSI_INSTRUMENT_ME,
|
||||
(fields->elements+1) *
|
||||
sizeof(SORT_FIELD),
|
||||
MYF(MY_WME))))
|
||||
MYF(MY_WME | MY_ZEROFILL))))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/* Calculate how many saved fields there is in list */
|
||||
@@ -25086,7 +25086,6 @@ JOIN_TAB::remove_duplicates()
|
||||
else
|
||||
{
|
||||
/* Item is not stored in temporary table, remember it */
|
||||
sorder->field= 0; // Safety, not used
|
||||
sorder->item= item;
|
||||
/* Calculate sorder->length */
|
||||
item->type_handler()->sort_length(thd, item, sorder);
|
||||
|
||||
@@ -1011,10 +1011,19 @@ bool Sql_cmd_alter_sequence::execute(THD *thd)
|
||||
else
|
||||
table->file->print_error(error, MYF(0));
|
||||
seq->write_unlock(table);
|
||||
if (trans_commit_stmt(thd))
|
||||
error= 1;
|
||||
if (trans_commit_implicit(thd))
|
||||
error= 1;
|
||||
{
|
||||
wait_for_commit* suspended_wfc= thd->suspend_subsequent_commits();
|
||||
if (trans_commit_stmt(thd))
|
||||
error= 1;
|
||||
if (trans_commit_implicit(thd))
|
||||
error= 1;
|
||||
thd->resume_subsequent_commits(suspended_wfc);
|
||||
DBUG_EXECUTE_IF("hold_worker_on_schedule",
|
||||
{
|
||||
/* delay binlogging of a parent trx in rpl_parallel_seq */
|
||||
my_sleep(100000);
|
||||
});
|
||||
}
|
||||
if (likely(!error))
|
||||
error= write_bin_log(thd, 1, thd->query(), thd->query_length());
|
||||
if (likely(!error))
|
||||
|
||||
@@ -3901,50 +3901,16 @@ double Histogram::point_selectivity(double pos, double avg_sel)
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
/*
|
||||
The value 'pos' fits within one single histogram bucket.
|
||||
|
||||
Histogram buckets have the same numbers of rows, but they cover
|
||||
different ranges of values.
|
||||
|
||||
We assume that values are uniformly distributed across the [0..1] value
|
||||
range.
|
||||
*/
|
||||
|
||||
/*
|
||||
If all buckets covered value ranges of the same size, the width of
|
||||
value range would be:
|
||||
We also have avg_sel which is per-table average selectivity of col=const.
|
||||
If there are popular values, this may be larger than one bucket, so
|
||||
cap the returned number by the selectivity of one bucket.
|
||||
*/
|
||||
double avg_bucket_width= 1.0 / (get_width() + 1);
|
||||
|
||||
/*
|
||||
Let's see what is the width of value range that our bucket is covering.
|
||||
(min==max currently. they are kept in the formula just in case we
|
||||
will want to extend it to handle multi-bucket case)
|
||||
*/
|
||||
double inv_prec_factor= (double) 1.0 / prec_factor();
|
||||
double current_bucket_width=
|
||||
(max + 1 == get_width() ? 1.0 : (get_value(max) * inv_prec_factor)) -
|
||||
(min == 0 ? 0.0 : (get_value(min-1) * inv_prec_factor));
|
||||
|
||||
DBUG_ASSERT(current_bucket_width); /* We shouldn't get a one zero-width bucket */
|
||||
|
||||
/*
|
||||
So:
|
||||
- each bucket has the same #rows
|
||||
- values are unformly distributed across the [min_value,max_value] domain.
|
||||
|
||||
If a bucket has value range that's N times bigger then average, than
|
||||
each value will have to have N times fewer rows than average.
|
||||
*/
|
||||
sel= avg_sel * avg_bucket_width / current_bucket_width;
|
||||
|
||||
/*
|
||||
(Q: if we just follow this proportion we may end up in a situation
|
||||
where number of different values we expect to find in this bucket
|
||||
exceeds the number of rows that this histogram has in a bucket. Are
|
||||
we ok with this or we would want to have certain caps?)
|
||||
*/
|
||||
sel= MY_MIN(avg_bucket_width, avg_sel);
|
||||
}
|
||||
return sel;
|
||||
}
|
||||
|
||||
@@ -226,6 +226,7 @@ void _CONCAT_UNDERSCORED(turn_parser_debug_on,yyparse)()
|
||||
Lex_for_loop_bounds_st for_loop_bounds;
|
||||
Lex_trim_st trim;
|
||||
Json_table_column::On_response json_on_response;
|
||||
Lex_substring_spec_st substring_spec;
|
||||
vers_history_point_t vers_history_point;
|
||||
struct
|
||||
{
|
||||
@@ -636,7 +637,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
||||
%token <kwd> RELEASE_SYM /* SQL-2003-R */
|
||||
%token <kwd> RENAME
|
||||
%token <kwd> REPEAT_SYM /* MYSQL-FUNC */
|
||||
%token <kwd> REPLACE /* MYSQL-FUNC */
|
||||
%token <kwd> REQUIRE_SYM
|
||||
%token <kwd> RESIGNAL_SYM /* SQL-2003-R */
|
||||
%token <kwd> RESTRICT
|
||||
@@ -673,7 +673,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
||||
%token <kwd> STDDEV_SAMP_SYM /* SQL-2003-N */
|
||||
%token <kwd> STD_SYM
|
||||
%token <kwd> STRAIGHT_JOIN
|
||||
%token <kwd> SUBSTRING /* SQL-2003-N */
|
||||
%token <kwd> SUM_SYM /* SQL-2003-N */
|
||||
%token <kwd> SYSDATE
|
||||
%token <kwd> TABLE_REF_PRIORITY
|
||||
@@ -686,7 +685,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
||||
%token <kwd> TO_SYM /* SQL-2003-R */
|
||||
%token <kwd> TRAILING /* SQL-2003-R */
|
||||
%token <kwd> TRIGGER_SYM /* SQL-2003-R */
|
||||
%token <kwd> TRIM /* SQL-2003-N */
|
||||
%token <kwd> TRUE_SYM /* SQL-2003-R */
|
||||
%token <kwd> UNDO_SYM /* FUTURE-USE */
|
||||
%token <kwd> UNION_SYM /* SQL-2003-R */
|
||||
@@ -731,6 +729,14 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
||||
%token <kwd> ROWTYPE_MARIADB_SYM // PLSQL-R
|
||||
%token <kwd> ROWNUM_SYM /* Oracle-R */
|
||||
|
||||
/*
|
||||
SQL functions with a special syntax
|
||||
*/
|
||||
%token <kwd> REPLACE /* MYSQL-FUNC */
|
||||
%token <kwd> SUBSTRING /* SQL-2003-N */
|
||||
%token <kwd> TRIM /* SQL-2003-N */
|
||||
|
||||
|
||||
/*
|
||||
Non-reserved keywords
|
||||
*/
|
||||
@@ -1762,6 +1768,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
||||
%type <for_loop> sp_for_loop_index_and_bounds
|
||||
%type <for_loop_bounds> sp_for_loop_bounds
|
||||
%type <trim> trim_operands
|
||||
%type <substring_spec> substring_operands
|
||||
%type <num> opt_sp_for_loop_direction
|
||||
%type <spvar_mode> sp_parameter_type
|
||||
%type <index_hint> index_hint_type
|
||||
@@ -10276,7 +10283,8 @@ function_call_keyword:
|
||||
}
|
||||
| TRIM '(' trim_operands ')'
|
||||
{
|
||||
if (unlikely(!($$= $3.make_item_func_trim(thd))))
|
||||
if (unlikely(!($$= Schema::find_implied(thd)->
|
||||
make_item_func_trim(thd, $3))))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| USER_SYM '(' ')'
|
||||
@@ -10295,6 +10303,26 @@ function_call_keyword:
|
||||
}
|
||||
;
|
||||
|
||||
substring_operands:
|
||||
expr ',' expr ',' expr
|
||||
{
|
||||
$$= Lex_substring_spec_st::init($1, $3, $5);
|
||||
}
|
||||
| expr ',' expr
|
||||
{
|
||||
$$= Lex_substring_spec_st::init($1, $3);
|
||||
}
|
||||
| expr FROM expr FOR_SYM expr
|
||||
{
|
||||
$$= Lex_substring_spec_st::init($1, $3, $5);
|
||||
}
|
||||
| expr FROM expr
|
||||
{
|
||||
$$= Lex_substring_spec_st::init($1, $3);
|
||||
}
|
||||
;
|
||||
|
||||
|
||||
/*
|
||||
Function calls using non reserved keywords, with special syntaxic forms.
|
||||
Dedicated grammar rules are needed because of the syntax,
|
||||
@@ -10427,24 +10455,10 @@ function_call_nonkeyword:
|
||||
if (unlikely($$ == NULL))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| SUBSTRING '(' expr ',' expr ',' expr ')'
|
||||
| SUBSTRING '(' substring_operands ')'
|
||||
{
|
||||
if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5, $7))))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| SUBSTRING '(' expr ',' expr ')'
|
||||
{
|
||||
if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5))))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| SUBSTRING '(' expr FROM expr FOR_SYM expr ')'
|
||||
{
|
||||
if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5, $7))))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| SUBSTRING '(' expr FROM expr ')'
|
||||
{
|
||||
if (unlikely(!($$= Lex->make_item_func_substr(thd, $3, $5))))
|
||||
if (unlikely(!($$= Schema::find_implied(thd)->
|
||||
make_item_func_substr(thd, $3))))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
%ifdef ORACLE
|
||||
@@ -10659,7 +10673,8 @@ function_call_conflict:
|
||||
}
|
||||
| REPLACE '(' expr ',' expr ',' expr ')'
|
||||
{
|
||||
if (unlikely(!($$= Lex->make_item_func_replace(thd, $3, $5, $7))))
|
||||
if (unlikely(!($$= Schema::find_implied(thd)->
|
||||
make_item_func_replace(thd, $3, $5, $7))))
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
| REVERSE_SYM '(' expr ')'
|
||||
|
||||
@@ -793,6 +793,11 @@ public:
|
||||
}
|
||||
Item *make_item_func_trim_std(THD *thd) const;
|
||||
Item *make_item_func_trim_oracle(THD *thd) const;
|
||||
/*
|
||||
This method is still used to handle LTRIM and RTRIM,
|
||||
while the special syntax TRIM(... BOTH|LEADING|TRAILING)
|
||||
is now handled by Schema::make_item_func_trim().
|
||||
*/
|
||||
Item *make_item_func_trim(THD *thd) const;
|
||||
};
|
||||
|
||||
@@ -804,6 +809,25 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class Lex_substring_spec_st
|
||||
{
|
||||
public:
|
||||
Item *m_subject;
|
||||
Item *m_from;
|
||||
Item *m_for;
|
||||
static Lex_substring_spec_st init(Item *subject,
|
||||
Item *from,
|
||||
Item *xfor= NULL)
|
||||
{
|
||||
Lex_substring_spec_st res;
|
||||
res.m_subject= subject;
|
||||
res.m_from= from;
|
||||
res.m_for= xfor;
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class st_select_lex;
|
||||
|
||||
class Lex_select_lock
|
||||
|
||||
@@ -3463,7 +3463,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
|
||||
char *sql_copy;
|
||||
handler *file;
|
||||
LEX *old_lex;
|
||||
Query_arena *arena, backup;
|
||||
LEX tmp_lex;
|
||||
KEY *unused1;
|
||||
uint unused2;
|
||||
@@ -3490,12 +3489,6 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
|
||||
old_lex= thd->lex;
|
||||
thd->lex= &tmp_lex;
|
||||
|
||||
arena= thd->stmt_arena;
|
||||
if (arena->is_conventional())
|
||||
arena= 0;
|
||||
else
|
||||
thd->set_n_backup_active_arena(arena, &backup);
|
||||
|
||||
thd->reset_db(&db);
|
||||
lex_start(thd);
|
||||
|
||||
@@ -3530,8 +3523,6 @@ ret:
|
||||
lex_end(thd->lex);
|
||||
thd->reset_db(&db_backup);
|
||||
thd->lex= old_lex;
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
reenable_binlog(thd);
|
||||
thd->variables.character_set_client= old_cs;
|
||||
if (unlikely(thd->is_error() || error))
|
||||
|
||||
@@ -1016,10 +1016,9 @@ int Wsrep_schema::append_fragment(THD* thd,
|
||||
Wsrep_schema_impl::store(frag_table, 3, flags);
|
||||
Wsrep_schema_impl::store(frag_table, 4, data.data(), data.size());
|
||||
|
||||
int error;
|
||||
if ((error= Wsrep_schema_impl::insert(frag_table))) {
|
||||
WSREP_ERROR("Failed to write to frag table: %d", error);
|
||||
if (Wsrep_schema_impl::insert(frag_table)) {
|
||||
trans_rollback_stmt(thd);
|
||||
close_thread_tables(thd);
|
||||
thd->lex->restore_backup_query_tables_list(&query_tables_list_backup);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,14 @@ static inline void wsrep_override_error(THD* thd,
|
||||
break;
|
||||
case wsrep::e_append_fragment_error:
|
||||
/* TODO: Figure out better error number */
|
||||
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status);
|
||||
if (status)
|
||||
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT,
|
||||
"Error while appending streaming replication fragment"
|
||||
"(provider status: %s)",
|
||||
wsrep::provider::to_string(status).c_str());
|
||||
else
|
||||
wsrep_override_error(thd, ER_ERROR_DURING_COMMIT,
|
||||
"Error while appending streaming replication fragment");
|
||||
break;
|
||||
case wsrep::e_not_supported_error:
|
||||
wsrep_override_error(thd, ER_NOT_SUPPORTED_YET);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2009, 2022, Oracle and/or its affiliates.
|
||||
# Copyright (c) 2009, 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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (c) 2009, 2022, Oracle and/or its affiliates.
|
||||
/* Copyright (c) 2009, 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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user