1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '12.0' into 12.1

This commit is contained in:
Sergei Golubchik
2025-06-05 12:00:59 +02:00
451 changed files with 15009 additions and 6955 deletions

View File

@@ -92,3 +92,24 @@ INSERT INTO t1 VALUES
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent=@default_stats_persistent;
#
# MDEV-36504 Memory leak after insert into empty table
#
CREATE TABLE t1 (k INT PRIMARY KEY)ENGINE=InnoDB;
INSERT INTO t1 SET k= 1;
START TRANSACTION;
INSERT INTO t1 SET k= 2;
SELECT COUNT(*) > 0 FROM mysql.innodb_index_stats LOCK IN SHARE MODE;
COUNT(*) > 0
1
connect con1,localhost,root,,,;
SET innodb_lock_wait_timeout=0;
CREATE TABLE t2(f1 INT DEFAULT 1 PRIMARY KEY)
STATS_PERSISTENT= 1 ENGINE=InnoDB as SELECT k FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
connection default;
SET innodb_lock_wait_timeout=default;
DROP TABLE t1;
DROP TABLE IF EXISTS t2;
# restart

View File

@@ -155,7 +155,6 @@ INSERT INTO parent SET a=0;
FLUSH TABLES;
# restart
disconnect incomplete;
SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = 0;
INSERT INTO child SET a=0;
INSERT INTO child SET a=1;
@@ -1186,6 +1185,25 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
ALTER TABLE t2 ADD KEY(b), ALGORITHM=NOCOPY;
DELETE FROM t1;
DROP TABLE t2, t1;
#
# MDEV-33167 ASAN errors after failing to load foreign key
# relation for the table
#
call mtr.add_suppression("InnoDB: Load table `test`.`t3` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.");
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t1(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))ENGINE=InnoDB;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t2(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))
ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t3(f1 VARCHAR(8) PRIMARY KEY)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
set GLOBAL innodb_fast_shutdown=0;
# restart
ALTER TABLE t2 FORCE;
DROP TABLE t2, t1, t3;
# End of 10.6 tests
CREATE TABLE t1
(
@@ -1208,5 +1226,4 @@ ALTER TABLE t2 ADD FOREIGN KEY (f2) REFERENCES t2 (f2),
ADD UNIQUE INDEX(f3);
ERROR HY000: Cannot delete rows from table which is parent in a foreign key constraint 't1_ibfk_1' of table 't1'
drop table t1, t2;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.11 tests

View File

@@ -12,12 +12,19 @@ select @@innodb_buffer_pool_size;
10485760
create table t1 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
create table t2 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$kbs;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384;
set global innodb_buffer_pool_size = 7340032;
select count(val) from t1;
count(val)
262144
select count(val) from t2;
count(val)
16384
set global innodb_adaptive_hash_index=OFF;
set global innodb_buffer_pool_size = 24117248;
set global innodb_buffer_pool_size = 26214400;
@@ -29,7 +36,10 @@ select @@innodb_buffer_pool_size;
select count(val) from t1;
count(val)
262144
drop table t1;
select count(val) from t2;
count(val)
16384
drop table t1,t2;
SET GLOBAL innodb_max_purge_lag_wait = 0;
SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm;

View File

@@ -19,7 +19,7 @@ connection default;
SET DEBUG_SYNC='now WAIT_FOR blocked';
SHOW STATUS LIKE 'innodb_buffer_pool_resize_status';
Variable_name Value
Innodb_buffer_pool_resize_status Withdrawing blocks. (506/506).
Innodb_buffer_pool_resize_status Withdrawing blocks. (505/505).
SET DEBUG_SYNC='now SIGNAL go';
connection con1;
disconnect con1;

View File

@@ -1,10 +1,11 @@
SET @save_innodb_timeout=@@innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout=1;
set session transaction isolation level read committed;
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
(what, id)) engine=innodb;
insert into innodb_bug52663 values ('total', 0, 0);
begin;
connect addconroot, localhost, root,,;
connection addconroot;
set session transaction isolation level read committed;
begin;
connection default;
@@ -31,3 +32,4 @@ select * from innodb_bug52663;
what id count
total 0 2
drop table innodb_bug52663;
SET GLOBAL innodb_lock_wait_timeout=@save_innodb_timeout;

View File

@@ -1,8 +1,9 @@
@@ -527,6 +527,6 @@
@@ -576,7 +576,7 @@
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-37
+38
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.6 tests
CREATE TABLE t1(f1 INT, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'a');
ALTER TABLE t1 ADD COLUMN f3 TEXT FIRST;

View File

@@ -569,5 +569,16 @@ FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
37
CREATE TABLE t1(f1 INT, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'a');
ALTER TABLE t1 ADD COLUMN f3 TEXT FIRST;
SET STATEMENT DEBUG_DBUG="+d,instant_insert_fail" FOR
ALTER TABLE t1 DROP COLUMN f1;
ERROR HY000: Internal error: InnoDB: Insert into SYS_COLUMNS failed
ALTER TABLE t1 DROP COLUMN f1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.6 tests

View File

@@ -1,3 +1,6 @@
connect disable_purging,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
#
# MDEV-26642 Weird SELECT view when a record is
# modified to the same value by two transactions
@@ -53,15 +56,17 @@ DROP TABLE t;
# MDEV-26643 Inconsistent behaviors of UPDATE under
# READ UNCOMMITTED and READ COMMITTED isolation level
#
CREATE TABLE t(a INT, b INT) ENGINE=InnoDB;
CREATE TABLE t(a INT, b INT) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES(NULL, 1), (2, 2);
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
BEGIN;
UPDATE t SET a = 10;
connection consistent;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
UPDATE t SET b = 20 WHERE a;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
connection consistent;
SELECT * FROM t;
@@ -75,8 +80,10 @@ BEGIN;
UPDATE t SET a = 10;
connection consistent;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
UPDATE t SET b = 20 WHERE a;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
connection consistent;
SELECT * FROM t;
@@ -90,8 +97,10 @@ BEGIN;
UPDATE t SET a = 10;
connection con_weird;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
UPDATE t SET b = 20 WHERE a;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
SELECT * FROM t;
a b
10 1
@@ -114,8 +123,10 @@ UPDATE t SET b = 3;
connection consistent;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
UPDATE t SET b = 2 WHERE a;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
UPDATE t SET a = 1;
COMMIT;
connection consistent;
@@ -129,20 +140,25 @@ DROP TABLE t;
#
# MDEV-33802 Weird read view after ROLLBACK of other transactions
#
CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
INSERT INTO t SET a=1;
BEGIN;
INSERT INTO t SET a=2;
CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB STATS_PERSISTENT=0;
connection consistent;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
INSERT INTO t SET a=1;
connection consistent;
SAVEPOINT sp1;
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
ERROR HY000: Record has changed since last read in table 't'
SAVEPOINT sp1;
connection default;
BEGIN;
INSERT INTO t SET a=2;
connection con_weird;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
ROLLBACK;
connection con_weird;
a b
@@ -150,12 +166,74 @@ a b
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
a b
1 NULL
COMMIT;
disconnect con_weird;
connection consistent;
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
a b
1 NULL
disconnect consistent;
COMMIT;
connection default;
TRUNCATE TABLE t;
#
# MDEV-36639 innodb_snapshot_isolation=1 gives error for not comitted row changes
#
INSERT INTO t VALUES (1,1),(2,2);
connection default;
# Case 1: Transaction A modifies a record, transaction B with snapshot
# isolation level is blocked by A, then A is committed.
# Expected behaviour: B gets ER_CHECKREAD.
BEGIN;
UPDATE t SET b=3 WHERE a = 1;
connection consistent;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t;
a b
1 1
2 2
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
SELECT * FROM t WHERE a=1 FOR UPDATE;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
connection consistent;
ERROR HY000: Record has changed since last read in table 't'
# Case 2: Transaction A modifies a record, transaction B with snapshot
# isolation level is blocked by A, then A is rolled back.
# Expected behaviour: B continues execution.
connection default;
BEGIN;
UPDATE t SET b=4 WHERE a=1;
connection consistent;
BEGIN;
SELECT * FROM t;
a b
2 2
1 3
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
SELECT * FROM t WHERE a=1 FOR UPDATE;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
ROLLBACK;
connection consistent;
a b
1 3
ROLLBACK;
# Case 3: Transaction B with snapshot isolation level started with
# consistent snapshot. Transaction A modifies a record and is committed.
# Both B tries to read modified by A record.
# Expected behavior: B gets ER_CHECKREAD.
connection consistent;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
UPDATE t SET b=4 WHERE a=1;
connection consistent;
SELECT * FROM t WHERE a=1 FOR UPDATE;
ERROR HY000: Record has changed since last read in table 't'
disconnect consistent;
disconnect disable_purging;
connection default;
SET DEBUG_SYNC="RESET";
DROP TABLE t;
# End of 10.6 tests

View File

@@ -0,0 +1,25 @@
# restart
SET GLOBAL innodb_file_per_table= 0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
SET GLOBAL innodb_limit_optimistic_insert_debug = 2;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
SET GLOBAL innodb_file_per_table= default;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,f2 VARCHAR(40))ENGINE=InnoDB PARTITION BY KEY() PARTITIONS 256;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
DROP TABLE t2, t1;
InnoDB 0 transactions not purged
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 205520896
set GLOBAL innodb_fast_shutdown= 0;
# restart
FOUND 1 /InnoDB: Moving the data from extents 4096 through 22016/ in mysqld.1.err
FOUND 1 /InnoDB: Defragmentation of system tablespace is successful/ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 14680064
# restart

View File

@@ -0,0 +1,52 @@
call mtr.add_suppression("InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed: Data structure corruption");
call mtr.add_suppression("InnoDB: Defragmentation of CLUST_IND in SYS_COLUMNS failed: Data structure corruption");
call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace");
# restart
set GLOBAL innodb_file_per_table = 0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
set GLOBAL innodb_limit_optimistic_insert_debug = 2;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
SET GLOBAL innodb_file_per_table= 1;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,
f2 VARCHAR(40))ENGINE=InnoDB PARTITION BY KEY() PARTITIONS 256;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
DROP TABLE t2;
InnoDB 0 transactions not purged
# restart
FOUND 1 /InnoDB: User table exists in the system tablespace/ in mysqld.1.err
DROP TABLE t1;
InnoDB 0 transactions not purged
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart: --debug_dbug=+d,fail_after_level_defragment
FOUND 1 /InnoDB: Defragmentation of CLUST_IND in SYS_COLUMNS failed./ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart: --debug_dbug=d,allocation_prepare_fail
FOUND 1 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart: --debug_dbug=d,relation_page_prepare_fail
FOUND 2 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart: --debug_dbug=d,remover_prepare_fail
FOUND 3 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart
FOUND 5 /InnoDB: Moving the data from extents 4096 through 8960/ in mysqld.1.err
FOUND 1 /InnoDB: Defragmentation of system tablespace is successful/ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 15728640
# restart

View File

@@ -4,7 +4,7 @@ Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a fu
SET UNIQUE_CHECKS=0, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
f3 INT NOT NULL, INDEX(f1),
INDEX(f2), INDEX(f3))ENGINE=InnoDB;
INDEX(f2), INDEX(f3))STATS_PERSISTENT=0 ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;

View File

@@ -9,7 +9,7 @@ Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a fu
SET UNIQUE_CHECKS=0, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
f3 INT NOT NULL, INDEX(f1),
INDEX(f2), INDEX(f3))ENGINE=InnoDB;
INDEX(f2), INDEX(f3))STATS_PERSISTENT=0 ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;