Skip to content

Commit

Permalink
Merge branch '10.4' into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Apr 16, 2024
2 parents ce104d4 + 50998a6 commit 9b18275
Show file tree
Hide file tree
Showing 85 changed files with 1,181 additions and 1,729 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,10 @@ OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system librar
# Enable protection of statement's memory root after first SP/PS execution.
# Can be switched on only for debug build.
#
OPTION(WITH_PROTECT_STATEMENT_MEMROOT "Enable protection of statement's memory root after first SP/PS execution. Turned into account only for debug build" OFF)
IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND WITH_PROTECT_STATEMENT_MEMROOT)
ADD_DEFINITIONS(-DPROTECT_STATEMENT_MEMROOT)
OPTION(WITH_PROTECT_STATEMENT_MEMROOT "Enable protection of statement's memory root after first SP/PS execution. Turned into account only for debug build" ON)
IF (WITH_PROTECT_STATEMENT_MEMROOT)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT")
ENDIF()

INCLUDE(check_compiler_flag)
Expand Down
22 changes: 22 additions & 0 deletions mysql-test/main/join_cache.result
Original file line number Diff line number Diff line change
Expand Up @@ -6396,5 +6396,27 @@ b b d c c
10 NULL NULL NULL NULL
DROP TABLE t1,t2,t3,t4;
#
# MDEV-21102: Server crashes in JOIN_CACHE::write_record_data upon EXPLAIN with subqueries and constant tables
#
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
CREATE TABLE t2 (c int, d int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,10);
CREATE TABLE t3 (e int, key (e)) ENGINE=MyISAM;
INSERT INTO t3 VALUES (2),(3);
# Must not crash, must use join buffer in subquery
EXPLAIN
SELECT * FROM t1
WHERE a > b OR a IN (
SELECT c FROM t2 WHERE EXISTS (
SELECT * FROM t3 t3a JOIN t3 t3b WHERE t3a.e < d
)
);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 DEPENDENT SUBQUERY t2 system NULL NULL NULL NULL 1
3 SUBQUERY t3a range e e 5 NULL 2 Using where; Using index
3 SUBQUERY t3b index NULL e 5 NULL 2 Using index; Using join buffer (flat, BNL join)
DROP TABLE t1,t2,t3;
#
# End of 10.4 tests
#
21 changes: 21 additions & 0 deletions mysql-test/main/join_cache.test
Original file line number Diff line number Diff line change
Expand Up @@ -4305,6 +4305,27 @@ eval $q2;

DROP TABLE t1,t2,t3,t4;

--echo #
--echo # MDEV-21102: Server crashes in JOIN_CACHE::write_record_data upon EXPLAIN with subqueries and constant tables
--echo #
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;

CREATE TABLE t2 (c int, d int) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1,10);

CREATE TABLE t3 (e int, key (e)) ENGINE=MyISAM;
INSERT INTO t3 VALUES (2),(3);

--echo # Must not crash, must use join buffer in subquery
EXPLAIN
SELECT * FROM t1
WHERE a > b OR a IN (
SELECT c FROM t2 WHERE EXISTS (
SELECT * FROM t3 t3a JOIN t3 t3b WHERE t3a.e < d
)
);
DROP TABLE t1,t2,t3;

--echo #
--echo # End of 10.4 tests
--echo #
3 changes: 3 additions & 0 deletions mysql-test/main/kill_processlist-6619.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
--source include/not_embedded.inc
--source include/have_debug_sync.inc

let $wait_condition=select count(*) = 1 from information_schema.processlist;
source include/wait_condition.inc;

# Ensure no lingering connections from an earlier test run, which can very
# rarely still be visible in SHOW PROCESSLIST here.
--let $wait_condition= SELECT COUNT(*) = 1 from information_schema.processlist
Expand Down
30 changes: 30 additions & 0 deletions mysql-test/main/query_cache.result
Original file line number Diff line number Diff line change
Expand Up @@ -2208,9 +2208,39 @@ Qcache_queries_in_cache 0
DROP FUNCTION foo;
drop table t1;
#
# MDEV-33861: main.query_cache fails with embedded after
# enabling WITH_PROTECT_STATEMENT_MEMROOT
#
create table t1 (s1 int);
create procedure f3 () begin
select * from t1;
end;
//
create procedure f4 () begin
select * from t1;
end;
//
Call f4();
s1
cAll f3();
s1
insert into t1 values (2);
caLl f3();
s1
2
drop procedure f3;
drop procedure f4;
drop table t1;
#
# End of 10.4 tests
#
#
# MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression
#
set global Query_cache_size=18446744073709547520;
#
# End of 10.5 tests
#
restore defaults
SET GLOBAL query_cache_type= default;
SET GLOBAL query_cache_size=@save_query_cache_size;
38 changes: 38 additions & 0 deletions mysql-test/main/query_cache.test
Original file line number Diff line number Diff line change
Expand Up @@ -1803,13 +1803,51 @@ show status like "Qcache_queries_in_cache";
DROP FUNCTION foo;
drop table t1;

--echo #
--echo # MDEV-33861: main.query_cache fails with embedded after
--echo # enabling WITH_PROTECT_STATEMENT_MEMROOT
--echo #

create table t1 (s1 int);
--delimiter //
create procedure f3 () begin
select * from t1;
end;
//
create procedure f4 () begin
select * from t1;
end;
//
--delimiter ;

Call f4();

cAll f3();

insert into t1 values (2);

caLl f3();

drop procedure f3;
drop procedure f4;
drop table t1;


--echo #
--echo # End of 10.4 tests
--echo #

--echo #
--echo # MDEV-24858 SIGABRT in DbugExit from my_malloc in Query_cache::init_cache Regression
--echo #
--disable_warnings
set global Query_cache_size=18446744073709547520;
--enable_warnings

--echo #
--echo # End of 10.5 tests
--echo #

--echo restore defaults
SET GLOBAL query_cache_type= default;
SET GLOBAL query_cache_size=@save_query_cache_size;
Expand Down
18 changes: 0 additions & 18 deletions mysql-test/suite/galera/include/shutdown_mysqld.inc

This file was deleted.

6 changes: 6 additions & 0 deletions mysql-test/suite/galera/r/MDEV-26499.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
SET GLOBAL debug_dbug="+d,simulate_slow_client_at_shutdown";
20 changes: 20 additions & 0 deletions mysql-test/suite/galera/t/MDEV-26499.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# MDEV-26499
#
# This test reproduces some failure on mysql_shutdown() call
# which manifests sporadically in some galera MTR tests during
# restart of a node.
#

--source include/galera_cluster.inc
--source include/have_debug_sync.inc

--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc

--connection node_2
SET GLOBAL debug_dbug="+d,simulate_slow_client_at_shutdown";
--source include/restart_mysqld.inc

--source include/auto_increment_offset_restore.inc
6 changes: 3 additions & 3 deletions mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:29:25.129637040 +0530
--- mysql-test/suite/innodb/r/check_ibd_filesize.result
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject
@@ -3,18 +3,12 @@
# SPACE IN 5.7 THAN IN 5.6
#
Expand All @@ -14,7 +14,7 @@
-# bytes: 65536
+# bytes: 131072
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
-# bytes: 4194304
-# bytes: 2097152
-DROP TABLE t1;
-CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:39.288769153 +0530
--- mysql-test/suite/innodb/r/check_ibd_filesize.result
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject
@@ -3,18 +3,18 @@
# SPACE IN 5.7 THAN IN 5.6
#
Expand All @@ -13,7 +13,7 @@
-# bytes: 65536
+# bytes: 16384
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
# bytes: 4194304
# bytes: 2097152
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:30:28.957174270 +0530
--- mysql-test/suite/innodb/r/check_ibd_filesize.result
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject
@@ -3,18 +3,12 @@
# SPACE IN 5.7 THAN IN 5.6
#
Expand All @@ -14,7 +14,7 @@
-# bytes: 65536
+# bytes: 262144
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
-# bytes: 4194304
-# bytes: 2097152
-DROP TABLE t1;
-CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
Expand Down
6 changes: 3 additions & 3 deletions mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:03.516962339 +0530
--- mysql-test/suite/innodb/r/check_ibd_filesize.result
+++ mysql-test/suite/innodb/r/check_ibd_filesize.reject
@@ -3,18 +3,18 @@
# SPACE IN 5.7 THAN IN 5.6
#
Expand All @@ -13,7 +13,7 @@
-# bytes: 65536
+# bytes: 32768
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
# bytes: 4194304
# bytes: 2097152
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/innodb/r/check_ibd_filesize.result
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
# bytes: 65536
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
# bytes: 4194304
# bytes: 2097152
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
Expand Down
24 changes: 24 additions & 0 deletions mysql-test/suite/innodb/r/cursor-restore-unique-null.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
CREATE TABLE t(a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `b_c` (`b`,`c`))
ENGINE=InnoDB, STATS_PERSISTENT=0;
INSERT INTO t SET a = 1, c = 2;
connect con1,localhost,root;
BEGIN;
INSERT INTO t SET a=2, c=2;
connection default;
BEGIN;
SET DEBUG_SYNC="lock_wait_suspend_thread_enter SIGNAL select_locked";
SELECT * FROM t FORCE INDEX(b) FOR UPDATE;
connection con1;
SET DEBUG_SYNC="now WAIT_FOR select_locked";
ROLLBACK;
connection default;
# If the bug is not fixed, and the both unique index key fields are
# NULL, there will be two (1, NULL, 2) rows in the result,
# because cursor will be restored to (NULL, 2, 1) position for
# secondary key instead of "supremum".
a b c
1 NULL 2
COMMIT;
SET DEBUG_SYNC="RESET";
disconnect con1;
DROP TABLE t;
1 change: 1 addition & 0 deletions mysql-test/suite/innodb/r/instant_alter_import.result
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ alter table t1 discard tablespace;
flush tables t2 for export;
unlock tables;
alter table t1 import tablespace;
# restart
select * from t1;
z
42
Expand Down
36 changes: 36 additions & 0 deletions mysql-test/suite/innodb/t/cursor-restore-unique-null.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc


CREATE TABLE t(a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `b_c` (`b`,`c`))
ENGINE=InnoDB, STATS_PERSISTENT=0;
INSERT INTO t SET a = 1, c = 2;

--connect con1,localhost,root
BEGIN;
INSERT INTO t SET a=2, c=2;

--connection default
BEGIN;
SET DEBUG_SYNC="lock_wait_suspend_thread_enter SIGNAL select_locked";
--send SELECT * FROM t FORCE INDEX(b) FOR UPDATE

--connection con1
SET DEBUG_SYNC="now WAIT_FOR select_locked";
ROLLBACK;

--connection default
--echo # If the bug is not fixed, and the both unique index key fields are
--echo # NULL, there will be two (1, NULL, 2) rows in the result,
--echo # because cursor will be restored to (NULL, 2, 1) position for
--echo # secondary key instead of "supremum".
--reap
COMMIT;

SET DEBUG_SYNC="RESET";

--disconnect con1
DROP TABLE t;
--source include/wait_until_count_sessions.inc
1 change: 1 addition & 0 deletions mysql-test/suite/innodb/t/instant_alter_import.test
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ flush tables t2 for export;
unlock tables;

alter table t1 import tablespace;
--source include/restart_mysqld.inc
select * from t1;

drop table t2;
Expand Down
5 changes: 5 additions & 0 deletions mysql-test/suite/parts/r/mdev_21007.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CREATE TABLE t1 (a INT) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1), PARTITION p1 VALUES LESS THAN (MAXVALUE));
INSERT INTO t1 VALUES (1),(2);
ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
UPDATE t1 PARTITION (p1) SET a=9 ORDER BY a LIMIT 1;
DROP TABLE t1;
9 changes: 9 additions & 0 deletions mysql-test/suite/parts/t/mdev_21007.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--source include/have_partition.inc

CREATE TABLE t1 (a INT) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1), PARTITION p1 VALUES LESS THAN (MAXVALUE));
INSERT INTO t1 VALUES (1),(2);
ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
UPDATE t1 PARTITION (p1) SET a=9 ORDER BY a LIMIT 1;

# Cleanup
DROP TABLE t1;
2 changes: 1 addition & 1 deletion sql/ha_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8516,7 +8516,7 @@ int ha_partition::info(uint flag)
file->stats.auto_increment_value);
} while (*(++file_array));

DBUG_ASSERT(auto_increment_value);
DBUG_ASSERT(!all_parts_opened || auto_increment_value);
stats.auto_increment_value= auto_increment_value;
if (all_parts_opened && auto_inc_is_first_in_idx)
{
Expand Down

0 comments on commit 9b18275

Please sign in to comment.