Skip to content

Commit

Permalink
Merge branch 'bb-10.5-release' into bb-10.6-release
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Jun 5, 2023
2 parents fcfd636 + bed7046 commit a42a6fa
Show file tree
Hide file tree
Showing 22 changed files with 379 additions and 116 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=6
MYSQL_VERSION_PATCH=13
MYSQL_VERSION_PATCH=14
SERVER_MATURITY=stable
94 changes: 94 additions & 0 deletions mysql-test/main/derived_cond_pushdown.result
Expand Up @@ -18331,4 +18331,98 @@ a
deallocate prepare stmt;
drop view v1;
drop table t1;
#
# MDEV-31240: condition pushed into splittable derived has reference to
# outer column and does not refer to any column of embedding
# select
#
create table t1 (a int);
insert into t1 select seq from seq_1_to_1000;
create table t2 (a int, b int, key (a));
insert into t2 select mod(seq,100), rand(13) * mod(seq,500) from seq_1_to_1000;
create table t3 (a int);
insert into t3 values (3), (1);
analyze table t1, t2, t3 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
explain select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 2
3 LATERAL DERIVED t2 ref a a 5 test.t1.a 10
select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
a ( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
1 1=804
2 1=1056
3 1=846
4 1=947
5 1=973
truncate table t2;
insert into t2 select mod(seq,10), rand(15) * mod(seq,500) from seq_1_to_1000;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
explain select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 100
3 DERIVED t2 ALL a NULL NULL NULL 1000 Using temporary; Using filesort
select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
a ( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
1 1=11858
2 1=11380
3 1=11588
4 1=11373
5 1=11612
drop table t1,t2,t3;
# End of 10.4 tests
41 changes: 41 additions & 0 deletions mysql-test/main/derived_cond_pushdown.test
Expand Up @@ -3973,4 +3973,45 @@ deallocate prepare stmt;
drop view v1;
drop table t1;

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

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

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

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

analyze table t1, t2, t3 persistent for all;

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

eval explain $q;
eval $q;

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

analyze table t2 persistent for all;

eval explain $q;
eval $q;

drop table t1,t2,t3;

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

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

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

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

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

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

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

--echo # End of 10.4 tests

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

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

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

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

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

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

DROP TABLE t1, t2;

--echo # End of 10.4 tests
4 changes: 2 additions & 2 deletions mysql-test/main/myisam_explain_non_select_all.result
Expand Up @@ -2689,7 +2689,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings:
Note 1003 update `test`.`t1` set NULL = 10
Note 1003 update `test`.`t1` set `test`.`t2`.`c2` = 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 7
Expand Down Expand Up @@ -2734,7 +2734,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 update `test`.`t1` set NULL = 10 where `test`.`t1`.`c3` = 10
Note 1003 update `test`.`t1` set `test`.`t2`.`c2` = 10 where `test`.`t1`.`c3` = 10
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 7
Expand Down
23 changes: 23 additions & 0 deletions mysql-test/suite/galera/r/MDEV-24143.result
@@ -0,0 +1,23 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY (10), c3 DATETIME);
SELECT get_lock ('test2', 0);
get_lock ('test2', 0)
1
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
SET SESSION wsrep_trx_fragment_size=10;
SET SESSION autocommit=0;
SELECT * FROM t1 WHERE c1 <=0 ORDER BY c1 DESC;
c1
INSERT INTO t1 VALUES (4),(3),(1),(2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE;
ERROR 42S01: Table 't1' already exists
ALTER TABLE t1 DROP COLUMN c2;
ERROR 42000: Can't DROP COLUMN `c2`; check that it exists
SELECT get_lock ('test', 1.5);
get_lock ('test', 1.5)
1
DROP TABLE t1;
18 changes: 18 additions & 0 deletions mysql-test/suite/galera/r/galera_bf_abort_get_lock.result
@@ -0,0 +1,18 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection node_2a;
SELECT GET_LOCK("foo", 1000);
GET_LOCK("foo", 1000)
1
connection node_2;
SET AUTOCOMMIT=OFF;
INSERT INTO t1 VALUES (1);
SELECT GET_LOCK("foo", 1000);;
connection node_1;
INSERT INTO t1 VALUES (1);
connection node_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_aborts_increment
1
DROP TABLE t1;
24 changes: 0 additions & 24 deletions mysql-test/suite/galera/r/galera_locks_funcs.result

This file was deleted.

20 changes: 20 additions & 0 deletions mysql-test/suite/galera/t/MDEV-24143.test
@@ -0,0 +1,20 @@
--source include/galera_cluster.inc
--source include/have_sequence.inc

CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY (10), c3 DATETIME);
SELECT get_lock ('test2', 0);
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
SET SESSION wsrep_trx_fragment_size=10;
SET SESSION autocommit=0;
SELECT * FROM t1 WHERE c1 <=0 ORDER BY c1 DESC;
--error ER_LOCK_DEADLOCK
INSERT INTO t1 VALUES (4),(3),(1),(2);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN c2;
SELECT get_lock ('test', 1.5);
DROP TABLE t1;

36 changes: 36 additions & 0 deletions mysql-test/suite/galera/t/galera_bf_abort_get_lock.test
@@ -0,0 +1,36 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc

#
# Test a local transaction being aborted by a slave one while it is running a GET_LOCK()
#

CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;

--let $galera_connection_name = node_2a
--let $galera_server_number = 2
--source include/galera_connect.inc
--connection node_2a
SELECT GET_LOCK("foo", 1000);

--connection node_2
SET AUTOCOMMIT=OFF;
--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
INSERT INTO t1 VALUES (1);
--send SELECT GET_LOCK("foo", 1000);

--connection node_1
INSERT INTO t1 VALUES (1);

--connection node_2
--error ER_LOCK_DEADLOCK
--reap

--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`

# Check that wsrep_local_bf_aborts has been incremented by exactly 1
--disable_query_log
--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment;
--enable_query_log

DROP TABLE t1;

0 comments on commit a42a6fa

Please sign in to comment.