1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge tag '11.4' into 11.6

MariaDB 11.4.4 release
This commit is contained in:
Oleksandr Byelkin
2024-11-08 07:17:00 +01:00
743 changed files with 10281 additions and 4508 deletions

View File

@ -50,4 +50,20 @@ ALTER TABLE t2 ALGORITHM=COPY, FORCE;
affected rows: 1
info: Records: 1 Duplicates: 0 Warnings: 0
DROP TABLE t2, t1;
#
# MDEV-35237 Bulk insert fails to apply buffered
# operation during copy alter
#
CREATE TABLE t1 (f1 int NOT NULL, f2 tinyint(1) NOT NULL,
f3 varchar(80) NOT NULL, PRIMARY KEY(f1),
KEY(f2), KEY(f3))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1,1,''),(2,0,''), (4,1,'e');
CREATE TABLE t2 (f1 int NOT NULL, f2 int NOT NULL,KEY(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,0),(1,0);
CREATE TABLE t engine=innodb
SELECT t2.f2 FROM t2 JOIN t1 ON t1.f1 = t2.f1 AND t1.f3 = '' AND t1.f2=1 ;
SELECT COUNT(*) FROM t;
COUNT(*)
2
DROP TABLE t1, t2, t;
SET GLOBAL innodb_stats_persistent=@default_stats_persistent;

View File

@ -8,8 +8,10 @@ INSERT INTO t2 VALUES(1);
# Corrupt the pages
SELECT * FROM t1;
ERROR 42000: Unknown storage engine 'InnoDB'
FOUND 1 /InnoDB: Page \[page id: space=[1-9][0-9]*, page number=3\] log sequence number 1311768467463790320 is in the future!/ in mysqld.1.err
SELECT * FROM t1;
Got one of the listed errors
a
1
SELECT * FROM t2;
a
1
@ -27,7 +29,7 @@ SET GLOBAL innodb_flush_log_at_trx_commit=1;
DELETE FROM t1 WHERE pk=3;
# Kill the server
disconnect con1;
# Corrupt the pages
# Corrupt the page
SELECT * FROM t1;
pk
1

View File

@ -0,0 +1,21 @@
#
# MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value
#
set innodb_compression_default= off;
create table t1 (a int, b blob) engine=innodb;
set innodb_compression_default= on;
create table s_import like t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` blob DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
show create table s_import;
Table Create Table
s_import CREATE TABLE `s_import` (
`a` int(11) DEFAULT NULL,
`b` blob DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
DROP TABLE t1,s_import;
# End of 10.5 tests

View File

@ -8,3 +8,13 @@ connection default;
ERROR 70100: Query execution was interrupted
CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB;
DROP TABLE t1;
# End of 10.2 tests
#
# MDEV-35236 Assertion `(mem_root->flags & 4) == 0' failed in safe_lexcstrdup_root
#
prepare stmt from 'create or replace table t engine=innodb select 1 as f';
set innodb_compression_default=on;
execute stmt;
execute stmt;
drop table t;
# End of 10.5 tests

View File

@ -21,8 +21,8 @@ connection default;
flush table t1 for export;
# Kill the server
# restart
FOUND 1 /InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile/ in mysqld.1.err
FOUND 1 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=3\]/ in mysqld.1.err
FOUND 1 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=0\]/ in mysqld.1.err
# restart
XA ROLLBACK 'x';
check table t1;
Table Op Msg_type Msg_text
@ -44,7 +44,7 @@ connection default;
flush table t1 for export;
# Kill the server
# restart
FOUND 1 /InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile/ in mysqld.1.err
FOUND 4 /InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=[03]\]/ in mysqld.1.err
XA ROLLBACK 'x';
check table t1;
Table Op Msg_type Msg_text

View File

@ -37,7 +37,7 @@ set global innodb_buf_flush_list_now = 1;
# Make the 1st page (page_no=0) and 2nd page (page_no=1)
# of the system tablespace all zeroes.
# restart
FOUND 1 /InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile/ in mysqld.1.err
FOUND 1 /InnoDB: Recovered page \[page id: space=0, page number=0\]/ in mysqld.1.err
FOUND 1 /InnoDB: Recovered page \[page id: space=0, page number=1\]/ in mysqld.1.err
check table t1;
Table Op Msg_type Msg_text
@ -66,7 +66,7 @@ set global innodb_buf_flush_list_now = 1;
# Kill the server
# Corrupt the 1st page (page_no=0) and 2nd page of the system tablespace.
# restart
FOUND 2 /InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile/ in mysqld.1.err
FOUND 2 /InnoDB: Recovered page \[page id: space=0, page number=0\]/ in mysqld.1.err
FOUND 2 /InnoDB: Recovered page \[page id: space=0, page number=1\]/ in mysqld.1.err
check table t1;
Table Op Msg_type Msg_text

View File

@ -9,8 +9,8 @@ call mtr.add_suppression("InnoDB: Page for tablespace ");
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=");
call mtr.add_suppression("InnoDB: Unknown index id .* on page");
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing");
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*ibdata1' page");
call mtr.add_suppression("InnoDB: File '.*ibdata1' is corrupted");
call mtr.add_suppression("InnoDB: Failed to read page \\d+ from file '.*test/t1\\.ibd'");
call mtr.add_suppression("InnoDB: File '.*(ibdata1|t1\\.ibd)' is corrupted");
FLUSH TABLES;
CREATE TABLE t1 (c1 INT) ENGINE = InnoDB;
INSERT INTO t1 VALUES(1),(2),(3);

View File

@ -1306,7 +1306,7 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
ERROR 42S22: Unknown column 't1.id' in 'WHERE'
drop table t3,t2,t1;
CREATE TABLE t1 (
c1 VARCHAR(8), c2 VARCHAR(8),

View File

@ -2556,7 +2556,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4);
INSERT INTO t3 SELECT * FROM t1;
** An error in a trigger causes rollback of the statement.
DELETE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
ERROR 42S22: Unknown column 'error_happens_here' in 'field list'
ERROR 42S22: Unknown column 'error_happens_here' in 'SET'
SELECT @a,@b;
@a @b
EXECUTED TRIGGER
@ -2570,7 +2570,7 @@ i i
4 4
** Same happens with the IGNORE option
DELETE IGNORE t1 FROM t3 LEFT JOIN t1 ON t1.i=t3.i;
ERROR 42S22: Unknown column 'error_happens_here' in 'field list'
ERROR 42S22: Unknown column 'error_happens_here' in 'SET'
SELECT * FROM t2;
a
SELECT * FROM t1 LEFT JOIN t3 ON t1.i=t3.i;

View File

@ -553,18 +553,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
@ -1487,18 +1487,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
@ -2421,18 +2421,18 @@ ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=never. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
SET GLOBAL innodb_instant_alter_column_allowed = add_drop_reorder;
ALTER TABLE t1 MODIFY b TEXT FIRST, ALGORITHM=INSTANT;
SET GLOBAL innodb_instant_alter_column_allowed = add_last;
ALTER TABLE t1 MODIFY a INT DEFAULT 1, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 ADD d TEXT AFTER a, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0, ALGORITHM=INSTANT;
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_atler_column_allowed=add_last. Try ALGORITHM=INPLACE
ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: innodb_instant_alter_column_allowed=add_last. Try ALGORITHM=INPLACE
ALTER TABLE t1 MODIFY a INT DEFAULT 0;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0

View File

@ -527,6 +527,15 @@ c INT as (b) VIRTUAL)ENGINE=InnoDB CHARACTER SET utf32;
ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 DROP COLUMN c;
DROP TABLE t1;
#
# MDEV-35122 Incorrect NULL value handling for instantly
# dropped BLOB columns
#
CREATE TABLE t1 (c1 INT, c2 BLOB, c3 BLOB NOT NULL) ROW_FORMAT=REDUNDANT,ENGINE=InnoDB;
ALTER TABLE t1 DROP c2;
ALTER TABLE t1 DROP c3;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
# End of 10.5 tests
# End of 10.6 tests
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;

View File

@ -135,8 +135,10 @@ BEGIN;
INSERT INTO t SET a=2;
connection consistent;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SAVEPOINT sp1;
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
ERROR HY000: Record has changed since last read in table 't'
SAVEPOINT sp1;
connection con_weird;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
@ -156,3 +158,4 @@ a b
disconnect consistent;
connection default;
DROP TABLE t;
# End of 10.6 tests

View File

@ -49,6 +49,7 @@ SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
FOUND 1 /InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\.ibd'/ in mysqld.1.err
# restart
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'

View File

@ -15,6 +15,7 @@ FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
set debug_dbug="d,trigger_garbage_collection";
SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size;
FOUND 1 /[Mm]emory pressure.*/ in mysqld.1.err
SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';

View File

@ -0,0 +1,6 @@
create table t_compressed(b longblob) engine=InnoDB page_compressed=1;
insert into t_compressed values(repeat(1,1000000));
select allocated_size < file_size from information_schema.innodb_sys_tablespaces where name='test/t_compressed';
allocated_size < file_size
1
drop table t_compressed;

View File

@ -6,3 +6,4 @@ FOUND 1 /page id mismatch/ in result.log
InnoDB 0 transactions not purged
drop table t1;
call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test/t1\\.ibd': Page read from tablespace is corrupted\\.");
call mtr.add_suppression("InnoDB: File '.*t1\\.ibd' is corrupted");

View File

@ -1,5 +1,6 @@
FLUSH TABLES;
call mtr.add_suppression("Found 1 prepared XA transactions");
call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0 or XA PREPARE transactions exist");
#
# MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup
# while rolling back recovered incomplete transactions

View File

@ -19,13 +19,20 @@ InnoDB 0 transactions not purged
SELECT NAME, FILE_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 540016640
# restart: --debug_dbug=+d,shrink_buffer_pool_full
# restart: --debug_dbug=+d,traversal_extent_fail
FOUND 1 /\[Warning\] InnoDB: Cannot shrink the system tablespace/ in mysqld.1.err
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
InnoDB YES Supports transactions, row-level locking, foreign keys and encryption for tables YES YES YES
# restart: --debug_dbug=+d,shrink_buffer_pool_full
FOUND 2 /\[Warning\] InnoDB: Cannot shrink the system tablespace/ in mysqld.1.err
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
ENGINE SUPPORT COMMENT TRANSACTIONS XA SAVEPOINTS
InnoDB YES Supports transactions, row-level locking, foreign keys and encryption for tables YES YES YES
# restart: --debug_dbug=+d,mtr_log_max_size
FOUND 1 /\[ERROR\] InnoDB: Cannot shrink the system tablespace/ in mysqld.1.err
SELECT * FROM INFORMATION_SCHEMA.ENGINES

View File

@ -151,7 +151,7 @@ t1 CREATE TEMPORARY TABLE `t1` (
UNIQUE KEY `pri_index` (`t1_i`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
select * from t1 where t1_f >= 2.5;
ERROR 42S22: Unknown column 't1_f' in 'where clause'
ERROR 42S22: Unknown column 't1_f' in 'WHERE'
alter table t1 add index sec_index2(t1_c), algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
drop table t1;

View File

@ -0,0 +1,25 @@
# restart: --debug_dbug=d,undo_segment_leak
SET GLOBAL INNODB_FILE_PER_TABLE=0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
UPDATE t1 SET f1 = f1 + 1 WHERE f1 > 1000;
UPDATE t1 SET f2 = f2 + 1 WHERE f1 > 1000;
UPDATE t1 SET f1 = f2 + 1 WHERE f1 > 1000;
UPDATE t1 SET f2 = f1 + 1 WHERE f1 > 1000;
DELETE FROM t1;
DROP TABLE t1;
set GLOBAL innodb_fast_shutdown=0;
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 79691776
# restart
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 12582912

View File

@ -0,0 +1,94 @@
call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0");
call mtr.add_suppression("InnoDB: :autoshrink failed to read the used segment");
call mtr.add_suppression("InnoDB: :autoshrink failed due to .* in FSP_SEG_INODES_FULL list");
call mtr.add_suppression("InnoDB: :autoshrink failed due to .* in FSP_SEG_INODES_FREE list");
call mtr.add_suppression("InnoDB: :autoshrink failed to free the segment");
call mtr.add_suppression("Found .* prepared XA transactions");
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 10485760
SET GLOBAL INNODB_FILE_PER_TABLE=0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)STATS_PERSISTENT=0, ENGINE=InnoDB;
XA START 'x';
insert into t1 values (1, 1);
XA END 'x';
XA PREPARE 'x';
set GLOBAL innodb_fast_shutdown=0;
# restart
# Fail to free the segment due to XA PREPARE transaction
FOUND 2 /InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0/ in mysqld.1.err
XA COMMIT 'x';
DROP TABLE t1;
# restart: --debug_dbug=d,undo_segment_leak
SET GLOBAL INNODB_FILE_PER_TABLE=0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)STATS_PERSISTENT=0, ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
UPDATE t1 SET f1 = f1 + 1 WHERE f1 > 1000;
UPDATE t1 SET f2 = f2 + 1 WHERE f1 > 1000;
UPDATE t1 SET f1 = f2 + 1 WHERE f1 > 1000;
UPDATE t1 SET f2 = f1 + 1 WHERE f1 > 1000;
DELETE FROM t1;
DROP TABLE t1;
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 77594624
# restart: --debug_dbug=d,unused_undo_free_fail_1
# Fail to free the segment due to previous shutdown
FOUND 4 /InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0/ in mysqld.1.err
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 15728640
SET GLOBAL innodb_fast_shutdown= 0;
# Fail to free the segment while finding the used segments
# restart: --debug_dbug=d,unused_undo_free_fail_2
SELECT IF(file_size>10485760,'ok',file_size) FROM information_schema.innodb_sys_tablespaces WHERE space=0;
IF(file_size>10485760,'ok',file_size)
ok
FOUND 1 /InnoDB: :autoshrink failed to read the used segment/ in mysqld.1.err
FOUND 1 /InnoDB: :autoshrink failed due to .* in FSP_SEG_INODES_FULL list/ in mysqld.1.err
SET GLOBAL innodb_fast_shutdown= 0;
# Fail to free the segment while finding the used segments
# restart: --debug_dbug=d,unused_undo_free_fail_3
SELECT IF(file_size>10485760,'ok',file_size) FROM information_schema.innodb_sys_tablespaces WHERE space=0;
IF(file_size>10485760,'ok',file_size)
ok
FOUND 1 /InnoDB: :autoshrink failed due to .* in FSP_SEG_INODES_FREE list/ in mysqld.1.err
SET GLOBAL innodb_fast_shutdown= 0;
# Fail to free the segment while freeing the unused segments
# restart: --debug_dbug=d,unused_undo_free_fail_4
SELECT IF(file_size>10485760,'ok',file_size) FROM information_schema.innodb_sys_tablespaces WHERE space=0;
IF(file_size>10485760,'ok',file_size)
ok
FOUND 1 /InnoDB: :autoshrink failed to free the segment .* in page .*/ in mysqld.1.err
SET GLOBAL innodb_fast_shutdown= 0;
# Fail to free the segment while freeing the used segments
# restart: --debug_dbug=d,unused_undo_free_fail_5
SELECT IF(file_size>10485760,'ok',file_size) FROM information_schema.innodb_sys_tablespaces WHERE space=0;
IF(file_size>10485760,'ok',file_size)
ok
FOUND 1 /InnoDB: :autoshrink failed to free the segment .* in page .*/ in mysqld.1.err
SET GLOBAL innodb_fast_shutdown= 0;
# restart
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 10485760
# Fail to reset the TRX_SYS_FSEG_HEADER during undo tablespace
# reinitialization. garbage_collect() shouldn't free the
# TRX_SYS_FSEG_HEADER index node
set global innodb_fast_shutdown=0;
# restart: --innodb_undo_tablespaces=2 --debug_dbug=d,sys_fseg_header_fail
FOUND 1 /InnoDB: :autoshrink freed the segment .* in page .*/ in mysqld.1.err
set global innodb_fast_shutdown=0;
# restart
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
NAME FILE_SIZE
innodb_system 10485760

View File

@ -12,7 +12,7 @@ set global innodb_fil_make_page_dirty_debug = 1;
SET GLOBAL innodb_buf_flush_list_now = 1;
# Kill the server
# restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0
FOUND 1 /Restoring page \[page id: space=1, page number=0\] of datafile '.*undo001' from the doublewrite buffer./ in mysqld.1.err
FOUND 1 /Recovered page \[page id: space=1, page number=0\] to '.*undo001' from the doublewrite buffer\./ in mysqld.1.err
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK

View File

@ -0,0 +1,66 @@
SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
@@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'CREATE TABLE t1(pk',
GROUP_CONCAT(seq SEPARATOR ' INT, pk'), ' INT, a',
GROUP_CONCAT(seq SEPARATOR ' INT, a'), ' INT, b',
GROUP_CONCAT(seq SEPARATOR ' INT, b'), ' INT, c INT, PRIMARY KEY(pk',
GROUP_CONCAT(seq SEPARATOR ', pk'), '), INDEX i1(a',
GROUP_CONCAT(seq SEPARATOR ', a'), '), INDEX i2(b',
GROUP_CONCAT(seq SEPARATOR ', b'), ')) ENGINE=InnoDB;')
FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'INSERT INTO t1 VALUES (',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',0), (',
GROUP_CONCAT('3' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
GROUP_CONCAT('4' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',0);')
FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
SET @old_timeout= @@GLOBAL.innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout= 1;
XA START "t1";
UPDATE t1 FORCE INDEX (i2) SET c=c+1 WHERE a1=1 AND b1=1;
XA END "t1";
XA PREPARE "t1";
connect con1,localhost,root,,;
SELECT a1, b1, c FROM t1 FORCE INDEX (i1) WHERE a1=2 AND b1=1 FOR UPDATE;
a1 b1 c
2 1 0
disconnect con1;
connection default;
XA COMMIT "t1";
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
@old_innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_lock_wait_timeout= @old_timeout;
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'ALTER TABLE t1 ADD COLUMN d',
GROUP_CONCAT(seq SEPARATOR ' INT, ADD COLUMN d'),
' INT, ADD INDEX i3(d',
GROUP_CONCAT(seq SEPARATOR ', d'), ');')
FROM seq_1_to_33);
EXECUTE IMMEDIATE c;
END;
$$
ERROR 42000: Too many key parts specified; max 32 parts allowed
DROP TABLE t1;

View File

@ -0,0 +1,68 @@
SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
@@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
SET @saved_dbug = @@GLOBAL.debug_dbug;
CREATE TABLE t(id INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
InnoDB 0 transactions not purged
INSERT INTO t VALUES (10), (20), (30);
connect prevent_purge,localhost,root,,;
start transaction with consistent snapshot;
connection default;
DELETE FROM t WHERE id = 20;
SET @@GLOBAL.debug_dbug=
"+d,enable_row_purge_remove_clust_if_poss_low_sync_point";
XA START '1';
UPDATE t SET id=40 WHERE id=30;
XA END '1';
connection prevent_purge;
COMMIT;
SET DEBUG_SYNC=
'now WAIT_FOR row_purge_remove_clust_if_poss_low_before_delete';
SET @@GLOBAL.debug_dbug=
"-d,enable_row_purge_remove_clust_if_poss_low_sync_point";
connection default;
SET DEBUG_SYNC=
"lock_rec_unlock_unmodified_start SIGNAL lock_sys_latched WAIT_FOR cont";
XA PREPARE '1';
connection prevent_purge;
SET DEBUG_SYNC= 'now SIGNAL row_purge_remove_clust_if_poss_low_cont';
SET DEBUG_SYNC= 'now SIGNAL cont';
disconnect prevent_purge;
connection default;
XA COMMIT '1';
SET DEBUG_SYNC="RESET";
TRUNCATE TABLE t;
InnoDB 0 transactions not purged
INSERT INTO t VALUES (10), (20), (30);
connect prevent_purge,localhost,root,,;
start transaction with consistent snapshot;
connection default;
DELETE FROM t WHERE id = 20;
SET @@GLOBAL.debug_dbug=
"+d,enable_row_purge_remove_clust_if_poss_low_sync_point";
SET @@GLOBAL.debug_dbug="+d,skip_lock_release_on_prepare_try";
XA START '1';
UPDATE t SET id=40 WHERE id=30;
XA END '1';
connection prevent_purge;
COMMIT;
SET DEBUG_SYNC=
'now WAIT_FOR row_purge_remove_clust_if_poss_low_before_delete';
SET @@GLOBAL.debug_dbug=
"-d,enable_row_purge_remove_clust_if_poss_low_sync_point";
connection default;
SET DEBUG_SYNC=
"lock_rec_unlock_unmodified_start SIGNAL lock_sys_latched WAIT_FOR cont";
XA PREPARE '1';
connection prevent_purge;
SET DEBUG_SYNC= 'now SIGNAL row_purge_remove_clust_if_poss_low_cont';
SET DEBUG_SYNC= 'now SIGNAL cont';
disconnect prevent_purge;
connection default;
XA COMMIT '1';
SET DEBUG_SYNC="RESET";
TRUNCATE TABLE t;
SET @@GLOBAL.debug_dbug = @saved_dbug;
DROP TABLE t;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
@old_innodb_enable_xap_unlock_unmodified_for_primary_debug;

View File

@ -68,4 +68,19 @@ ALTER TABLE t1 ALGORITHM=COPY, FORCE;
ALTER TABLE t2 ALGORITHM=COPY, FORCE;
--disable_info
DROP TABLE t2, t1;
--echo #
--echo # MDEV-35237 Bulk insert fails to apply buffered
--echo # operation during copy alter
--echo #
CREATE TABLE t1 (f1 int NOT NULL, f2 tinyint(1) NOT NULL,
f3 varchar(80) NOT NULL, PRIMARY KEY(f1),
KEY(f2), KEY(f3))ENGINE=InnoDB;
INSERT INTO t1 VALUES(1,1,''),(2,0,''), (4,1,'e');
CREATE TABLE t2 (f1 int NOT NULL, f2 int NOT NULL,KEY(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES (1,0),(1,0);
CREATE TABLE t engine=innodb
SELECT t2.f2 FROM t2 JOIN t1 ON t1.f1 = t2.f1 AND t1.f3 = '' AND t1.f2=1 ;
SELECT COUNT(*) FROM t;
DROP TABLE t1, t2, t;
SET GLOBAL innodb_stats_persistent=@default_stats_persistent;

View File

@ -4,15 +4,18 @@
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' init function returned error");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page");
call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test.t1\\.ibd': Page read from tablespace is corrupted.");
call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page .*, page number=3\\]");
call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate.");
call mtr.add_suppression("InnoDB: Unable to apply log to corrupted page 3 in file .*test.t1\\.ibd");
call mtr.add_suppression("Table `test`.`t1` is corrupted. Please drop the table and recreate\\.");
call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted");
call mtr.add_suppression("InnoDB: A long wait .* was observed for dict_sys");
call mtr.add_suppression("InnoDB: Page \\[page id: space=[1-9][0-9]*, page number=3\\] log sequence number 1311768467463790320 is in the future!");
call mtr.add_suppression("InnoDB: Your database may be corrupt");
call mtr.add_suppression("InnoDB: MySQL-8\\.0 tablespace in .*test/t2\\.ibd");
call mtr.add_suppression("InnoDB: Restart in MySQL for migration/recovery\\.");
--enable_query_log
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
let ALGO=`select @@innodb_checksum_algorithm`;
CREATE TABLE t1(a BIGINT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
# Force a redo log checkpoint.
@ -30,15 +33,32 @@ INSERT INTO t2 VALUES(1);
--echo # Corrupt the pages
perl;
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl";
my $polynomial = 0x82f63b78; # CRC-32C
my $algo = $ENV{ALGO};
my $ps = $ENV{INNODB_PAGE_SIZE};
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n";
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
# Replace the a=1 with a=0.
$page =~ s/\x80\x0\x0\x0\x0\x0\x0\x1/\x80\x0\x0\x0\x0\x0\x0\x0/;
# Assign a future FIL_PAGE_LSN
substr($page, 16, 8) = pack("NN", 0x12345678, 0x9abcdef0);
substr($page, $ps - 8, 8) = pack("NN", 0x9abcdef0, 0x9abcdef0);
if ($algo =~ /full_crc32/)
{
my $ck = mycrc32(substr($page, 0, $ps - 4), 0, $polynomial);
substr($page, $ps - 4, 4) = pack("N", $ck);
}
else
{
# Replace the innodb_checksum_algorithm=crc32 checksum
my $ck= pack("N",
mycrc32(substr($page, 4, 22), 0, $polynomial) ^
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
substr ($page, 0, 4) = $ck;
substr ($page, $ps - 8, 4) = $ck;
}
sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n";
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close FILE or die "close";
@ -46,20 +66,23 @@ close FILE or die "close";
$file = "$ENV{MYSQLD_DATADIR}/test/t2.ibd";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
# Corrupt pages 1 to 3. MLOG_INIT_FILE_PAGE2 should protect us!
# Unfortunately, we are not immune to page 0 corruption.
seek (FILE, $ps, SEEK_SET) or die "seek";
print FILE chr(0xff) x ($ps * 3);
# Corrupt pages 0 to 3. INIT_PAGE should protect us!
print FILE chr(0xff) x ($ps * 4);
close FILE or die "close";
EOF
--source include/start_mysqld.inc
--error ER_UNKNOWN_STORAGE_ENGINE
SELECT * FROM t1;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Page \\[page id: space=[1-9][0-9]*, page number=3\\] log sequence number 1311768467463790320 is in the future!;
--source include/search_pattern_in_file.inc
let $restart_parameters=--innodb_force_recovery=1;
--source include/restart_mysqld.inc
--error ER_NO_SUCH_TABLE_IN_ENGINE,ER_TABLE_CORRUPT
--error 0,ER_NO_SUCH_TABLE_IN_ENGINE
SELECT * FROM t1;
SELECT * FROM t2;
CHECK TABLE t2;
@ -81,13 +104,36 @@ DELETE FROM t1 WHERE pk=3;
--source ../include/no_checkpoint_end.inc
disconnect con1;
--echo # Corrupt the pages
--echo # Corrupt the page
perl;
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl";
my $polynomial = 0x82f63b78; # CRC-32C
my $algo = $ENV{ALGO};
my $ps = $ENV{INNODB_PAGE_SIZE};
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
seek (FILE, $ENV{INNODB_PAGE_SIZE} * 3, SEEK_SET) or die "seek";
print FILE "junk";
sysseek(FILE, $ps * 3, SEEK_SET) or die "seek";
sysread(FILE, $page, $ps)==$ps||die "Unable to read $file\n";
# Set FIL_PAGE_LSN to the maximum
substr($page, 16, 8) = chr(255) x 8;
substr($page, $ps - 8, 8) = chr(255) x 8;
if ($algo =~ /full_crc32/)
{
my $ck = mycrc32(substr($page, 0, $ps - 4), 0, $polynomial);
substr($page, $ps - 4, 4) = pack("N", $ck);
}
else
{
# Replace the innodb_checksum_algorithm=crc32 checksum
my $ck= pack("N",
mycrc32(substr($page, 4, 22), 0, $polynomial) ^
mycrc32(substr($page_, 38, $ps - 38 - 8), 0, $polynomial));
substr ($page, 0, 4) = $ck;
substr ($page, $ps - 8, 4) = $ck;
}
sysseek(FILE, $ps * 3, SEEK_SET) or die "seek";
syswrite(FILE, $page);
close FILE or die "close";
EOF
--source include/start_mysqld.inc

View File

@ -0,0 +1,16 @@
--source include/have_innodb.inc
--echo #
--echo # MDEV-35144 CREATE TABLE ... LIKE uses current innodb_compression_default instead of the create value
--echo #
set innodb_compression_default= off;
create table t1 (a int, b blob) engine=innodb;
set innodb_compression_default= on;
create table s_import like t1;
show create table t1;
show create table s_import;
DROP TABLE t1,s_import;
--echo # End of 10.5 tests

View File

@ -26,3 +26,16 @@ reap;
CREATE TABLE t1 (a SERIAL) ENGINE=InnoDB;
DROP TABLE t1;
--source include/wait_until_count_sessions.inc
--echo # End of 10.2 tests
--echo #
--echo # MDEV-35236 Assertion `(mem_root->flags & 4) == 0' failed in safe_lexcstrdup_root
--echo #
prepare stmt from 'create or replace table t engine=innodb select 1 as f';
set innodb_compression_default=on;
execute stmt;
execute stmt;
drop table t;
--echo # End of 10.5 tests

View File

@ -18,6 +18,9 @@ call mtr.add_suppression("InnoDB: Checksum mismatch in datafile: ");
call mtr.add_suppression("InnoDB: Inconsistent tablespace ID in .*t1\\.ibd");
call mtr.add_suppression("\\[Warning\\] Found 1 prepared XA transactions");
call mtr.add_suppression("InnoDB: Header page consists of zero bytes in datafile:");
call mtr.add_suppression("InnoDB: Page \\[page id: space=[1-9][0-9]*, page number=3\\] log sequence number 18446744073709551615 is in the future!");
call mtr.add_suppression("InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the ib_logfile0");
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
--enable_query_log
let INNODB_PAGE_SIZE=`select @@innodb_page_size`;
@ -71,7 +74,26 @@ syswrite(FILE, chr(0) x ($page_size/2));
sysseek(FILE, 3*$page_size, 0);
sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n";
sysseek(FILE, 3*$page_size, 0)||die "Unable to seek $fname\n";
syswrite(FILE, chr(0) x ($page_size/2));
my $corrupted = $page;
# Set FIL_PAGE_LSN to the maximum
substr($corrupted, 16, 8) = chr(255) x 8;
substr($corrupted, $page_size - 8, 8) = chr(255) x 8;
if ($algo =~ /full_crc32/)
{
my $ck = mycrc32(substr($corrupted, 0, $page_size - 4), 0, $polynomial);
substr($corrupted, $page_size - 4, 4) = pack("N", $ck);
}
else
{
# Replace the innodb_checksum_algorithm=crc32 checksum
my $ck= pack("N",
mycrc32(substr($corrupted, 4, 22), 0, $polynomial) ^
mycrc32(substr($corrupted_, 38, $page_size - 38 - 8), 0,
$polynomial));
substr ($corrupted, 0, 4) = $ck;
substr ($corrupted, $page_size - 8, 4) = $ck;
}
syswrite(FILE, $corrupted);
close FILE;
# Change the flag offset of page 0 in doublewrite buffer
@ -113,10 +135,28 @@ die "Did not find the page in the doublewrite buffer ($d1,$d2)\n";
EOF
--source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile;
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9][0-9]*, page number=0\\];
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN=InnoDB: Recovered page \[page id: space=[1-9][0-9]*, page number=3\];
let SEARCH_PATTERN=InnoDB: The log was only scanned up to \\d+, while the current LSN at the time of the latest checkpoint \\d+ was 0 and the maximum LSN on a data page was 18446744073709551615!
--source include/search_pattern_in_file.inc
--error ER_XAER_NOTA
XA ROLLBACK 'x';
let $shutdown_timeout=0;
--source include/shutdown_mysqld.inc
let $shutdown_timeout=;
# Corrupt the file in a better way.
perl;
use IO::Handle;
my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd";
my $page_size = $ENV{INNODB_PAGE_SIZE};
open(FILE, "+<", $fname) or die;
sysseek(FILE, ($page_size/2), 0);
syswrite(FILE, chr(0) x ($page_size/2));
sysseek(FILE, 3*$page_size, 0);
syswrite(FILE, chr(0) x ($page_size/2));
close FILE;
EOF
--source include/start_mysqld.inc
XA ROLLBACK 'x';
check table t1;
select f1, f2 from t1;
@ -144,7 +184,7 @@ close FILE;
EOF
--source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=[1-9][0-9]*, page number=0\] of datafile;
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9][0-9]*, page number=[03]\\];
--source include/search_pattern_in_file.inc
XA ROLLBACK 'x';
check table t1;

View File

@ -81,10 +81,10 @@ EOF
let $restart_parameters=;
--source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile;
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=0\\];
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN=InnoDB: Recovered page \[page id: space=0, page number=1\];
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=1\\];
--source include/search_pattern_in_file.inc
check table t1;
@ -129,10 +129,10 @@ EOF
let $restart_parameters=;
--source include/start_mysqld.inc
let SEARCH_PATTERN=InnoDB: Restoring page \[page id: space=0, page number=0\] of datafile;
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=0\\];
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN=InnoDB: Recovered page \[page id: space=0, page number=1\];
let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=0, page number=1\\];
--source include/search_pattern_in_file.inc
check table t1;

View File

@ -29,8 +29,8 @@ call mtr.add_suppression("InnoDB: Page for tablespace ");
call mtr.add_suppression("InnoDB: Invalid FSP_SPACE_FLAGS=");
call mtr.add_suppression("InnoDB: Unknown index id .* on page");
call mtr.add_suppression("InnoDB: Cannot save statistics for table `test`\\.`t1` because the \\.ibd file is missing");
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*ibdata1' page");
call mtr.add_suppression("InnoDB: File '.*ibdata1' is corrupted");
call mtr.add_suppression("InnoDB: Failed to read page \\d+ from file '.*test/t1\\.ibd'");
call mtr.add_suppression("InnoDB: File '.*(ibdata1|t1\\.ibd)' is corrupted");
FLUSH TABLES;
let MYSQLD_DATADIR =`SELECT @@datadir`;

View File

@ -9,7 +9,7 @@
--disable_query_log
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted\\. Please drop the table and recreate\\.");
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page");
call mtr.add_suppression("InnoDB: Failed to read page [1-9][0-9]* from file '.*test.t1\\.ibd'");
call mtr.add_suppression("InnoDB: We detected index corruption in an InnoDB type table");
call mtr.add_suppression("Index for table 't1' is corrupt; try to repair it");
call mtr.add_suppression("InnoDB: File '.*test/t1\\.ibd' is corrupted");

View File

@ -568,6 +568,16 @@ ALTER TABLE t1 DROP COLUMN a;
ALTER TABLE t1 DROP COLUMN c;
DROP TABLE t1;
--echo #
--echo # MDEV-35122 Incorrect NULL value handling for instantly
--echo # dropped BLOB columns
--echo #
CREATE TABLE t1 (c1 INT, c2 BLOB, c3 BLOB NOT NULL) ROW_FORMAT=REDUNDANT,ENGINE=InnoDB;
ALTER TABLE t1 DROP c2;
ALTER TABLE t1 DROP c3;
INSERT INTO t1 VALUES(1);
DROP TABLE t1;
--echo # End of 10.5 tests
--echo # End of 10.6 tests

View File

@ -2,9 +2,8 @@
--source include/have_debug.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Failed to read page 19 from file '.*test.t1\\.ibd': Page read from tablespace is corrupted\\.");
call mtr.add_suppression("InnoDB: (Unable to apply log to|Discarding log for) corrupted page .*, page number=19\\]");
call mtr.add_suppression("InnoDB: Unable to apply log to corrupted page 19 in file .*t1\\.ibd");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Plugin initialization aborted at srv0start\\.cc.* with error Data structure corruption");
call mtr.add_suppression("\\[ERROR\\] Plugin 'InnoDB' (init function|registration)");
call mtr.add_suppression("\\[ERROR\\] InnoDB: We detected index corruption");

View File

@ -153,10 +153,12 @@ BEGIN; INSERT INTO t SET a=2;
--connection consistent
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SAVEPOINT sp1;
--disable_ps2_protocol
--error ER_CHECKREAD
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
--enable_ps2_protocol
SAVEPOINT sp1;
--connection con_weird
START TRANSACTION WITH CONSISTENT SNAPSHOT;
@ -182,3 +184,5 @@ SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
--connection default
DROP TABLE t;
--echo # End of 10.6 tests

View File

@ -92,6 +92,7 @@ let SEARCH_PATTERN= InnoDB: Set innodb_force_recovery=1 to ignore this and to pe
--source include/start_mysqld.inc
eval $check_no_innodb;
--let $on_linux= `select @@version_compile_os LIKE 'Linux%'`
--source include/shutdown_mysqld.inc
let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
@ -105,9 +106,18 @@ let SEARCH_PATTERN= InnoDB: Tablespace \d+ was not found at .*t[12].ibd.
--source include/start_mysqld.inc
eval $check_no_innodb;
--source include/shutdown_mysqld.inc
# On Windows, this error message is not output when t2.ibd is a directory!
#let SEARCH_PATTERN= \[Note\] InnoDB: Cannot read first page of .*t2.ibd;
#--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'
if (!$on_linux)
{
# os_file_get_size() would succeed on a directory.
--echo FOUND 1 /$SEARCH_PATTERN/ in mysqld.1.err
}
if ($on_linux)
{
# lseek() reports EINVAL when invoked on a directory.
--source include/search_pattern_in_file.inc
}
--rmdir $MYSQLD_DATADIR/test/t2.ibd
@ -150,6 +160,7 @@ call mtr.add_suppression("InnoDB: Error number \\d+ means");
call mtr.add_suppression("InnoDB: Cannot create file '.*t0.ibd'");
call mtr.add_suppression("InnoDB: The file '.*t0\.ibd' already exists");
call mtr.add_suppression("InnoDB: Cannot open datafile for read-write: '.*t2\.ibd'");
call mtr.add_suppression("InnoDB: Could not measure the size of single-table tablespace file '.*test/t2\\.ibd'");
# The following are for aborted startup without --innodb-force-recovery:
call mtr.add_suppression("InnoDB: Tablespace .* was not found at .*test");
call mtr.add_suppression("InnoDB: Cannot read first page of '.*test.[tu]2.ibd': I/O error");

View File

@ -1,5 +1,5 @@
--source include/have_debug.inc
--source include/linux.inc
--source include/have_cgroupv2.inc
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
@ -33,12 +33,21 @@ WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
set debug_dbug="d,trigger_garbage_collection";
SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size;
SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
# either a fail or the pressure event
let SEARCH_PATTERN= [Mm]emory pressure.*;
--source include/search_pattern_in_file.inc
# The garbage collection happens asynchronously after trigger, in a background
# thread. So wait for it to happen to avoid sporadic failure.
let $wait_condition=
SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD
FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty';
--source include/wait_condition.inc
eval $wait_condition;
let SEARCH_PATTERN= InnoDB: Memory pressure event freed.*;
let SEARCH_WAIT= FOUND;
--source include/search_pattern_in_file.inc
set debug_dbug=@save_dbug;

View File

@ -0,0 +1 @@
--innodb-sys-tablespaces

View File

@ -0,0 +1,7 @@
--source include/have_innodb.inc
--source include/windows.inc
create table t_compressed(b longblob) engine=InnoDB page_compressed=1;
insert into t_compressed values(repeat(1,1000000));
# Check that compression worked, i.e allocated size (physical file size) < logical file size
select allocated_size < file_size from information_schema.innodb_sys_tablespaces where name='test/t_compressed';
drop table t_compressed;

View File

@ -66,5 +66,6 @@ let $restart_parameters=--innodb-force-recovery=1;
--source include/wait_all_purged.inc
drop table t1;
call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test/t1\\.ibd': Page read from tablespace is corrupted\\.");
call mtr.add_suppression("InnoDB: File '.*t1\\.ibd' is corrupted");
let $restart_parameters=;
--source include/restart_mysqld.inc

View File

@ -6,6 +6,7 @@
# Flush any open myisam tables from previous tests
FLUSH TABLES;
call mtr.add_suppression("Found 1 prepared XA transactions");
call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0 or XA PREPARE transactions exist");
--echo #
--echo # MDEV-13797 InnoDB may hang if shutdown is initiated soon after startup

View File

@ -23,6 +23,18 @@ DROP TABLE t1;
--source include/wait_all_purged.inc
SELECT NAME, FILE_SIZE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE SPACE = 0;
# Corruption during traversal of extent
let $restart_parameters=--debug_dbug=+d,traversal_extent_fail;
--source include/restart_mysqld.inc
--let SEARCH_PATTERN= \[Warning\] InnoDB: Cannot shrink the system tablespace
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/search_pattern_in_file.inc
SELECT * FROM INFORMATION_SCHEMA.ENGINES
WHERE engine = 'innodb'
AND support IN ('YES', 'DEFAULT', 'ENABLED');
# Ran out of buffer pool
let $restart_parameters=--debug_dbug=+d,shrink_buffer_pool_full;
--source include/restart_mysqld.inc

View File

@ -0,0 +1,2 @@
--innodb_undo_tablespaces=0
--innodb_sys_tablespaces

View File

@ -0,0 +1,26 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
--source include/not_embedded.inc
let $restart_parameters=--debug_dbug=d,undo_segment_leak;
--source include/restart_mysqld.inc
SET GLOBAL INNODB_FILE_PER_TABLE=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
UPDATE t1 SET f1 = f1 + 1 WHERE f1 > 1000;
UPDATE t1 SET f2 = f2 + 1 WHERE f1 > 1000;
UPDATE t1 SET f1 = f2 + 1 WHERE f1 > 1000;
UPDATE t1 SET f2 = f1 + 1 WHERE f1 > 1000;
DELETE FROM t1;
DROP TABLE t1;
set GLOBAL innodb_fast_shutdown=0;
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
let $restart_parameters=;
--source include/restart_mysqld.inc
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;

View File

@ -0,0 +1,3 @@
--innodb_data_file_path=ibdata1:10M:autoextend:autoshrink
--innodb_undo_tablespaces=0
--innodb_sys_tablespaces

View File

@ -0,0 +1,119 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
--source include/not_embedded.inc
call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0");
call mtr.add_suppression("InnoDB: :autoshrink failed to read the used segment");
call mtr.add_suppression("InnoDB: :autoshrink failed due to .* in FSP_SEG_INODES_FULL list");
call mtr.add_suppression("InnoDB: :autoshrink failed due to .* in FSP_SEG_INODES_FREE list");
call mtr.add_suppression("InnoDB: :autoshrink failed to free the segment");
call mtr.add_suppression("Found .* prepared XA transactions");
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
SET GLOBAL INNODB_FILE_PER_TABLE=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)STATS_PERSISTENT=0, ENGINE=InnoDB;
XA START 'x';
insert into t1 values (1, 1);
XA END 'x';
XA PREPARE 'x';
set GLOBAL innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
--echo # Fail to free the segment due to XA PREPARE transaction
let SEARCH_PATTERN= InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/search_pattern_in_file.inc
XA COMMIT 'x';
DROP TABLE t1;
let $restart_parameters=--debug_dbug=d,undo_segment_leak;
--source include/restart_mysqld.inc
SET GLOBAL INNODB_FILE_PER_TABLE=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)STATS_PERSISTENT=0, ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
UPDATE t1 SET f1 = f1 + 1 WHERE f1 > 1000;
UPDATE t1 SET f2 = f2 + 1 WHERE f1 > 1000;
UPDATE t1 SET f1 = f2 + 1 WHERE f1 > 1000;
UPDATE t1 SET f2 = f1 + 1 WHERE f1 > 1000;
DELETE FROM t1;
DROP TABLE t1;
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
let $shutdown_timeout=0;
let $restart_parameters=--debug_dbug=d,unused_undo_free_fail_1;
--source include/restart_mysqld.inc
let $shutdown_timeout=;
--echo # Fail to free the segment due to previous shutdown
--let SEARCH_PATTERN= InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/search_pattern_in_file.inc
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
SET GLOBAL innodb_fast_shutdown= 0;
--echo # Fail to free the segment while finding the used segments
let $restart_parameters=--debug_dbug=d,unused_undo_free_fail_2;
--source include/restart_mysqld.inc
SELECT IF(file_size>10485760,'ok',file_size) FROM information_schema.innodb_sys_tablespaces WHERE space=0;
let SEARCH_PATTERN= InnoDB: :autoshrink failed to read the used segment;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN= InnoDB: :autoshrink failed due to .* in FSP_SEG_INODES_FULL list;
--source include/search_pattern_in_file.inc
SET GLOBAL innodb_fast_shutdown= 0;
--echo # Fail to free the segment while finding the used segments
let $restart_parameters=--debug_dbug=d,unused_undo_free_fail_3;
--source include/restart_mysqld.inc
SELECT IF(file_size>10485760,'ok',file_size) FROM information_schema.innodb_sys_tablespaces WHERE space=0;
let SEARCH_PATTERN= InnoDB: :autoshrink failed due to .* in FSP_SEG_INODES_FREE list;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/search_pattern_in_file.inc
SET GLOBAL innodb_fast_shutdown= 0;
--echo # Fail to free the segment while freeing the unused segments
let $restart_parameters=--debug_dbug=d,unused_undo_free_fail_4;
--source include/restart_mysqld.inc
SELECT IF(file_size>10485760,'ok',file_size) FROM information_schema.innodb_sys_tablespaces WHERE space=0;
let SEARCH_PATTERN= InnoDB: :autoshrink failed to free the segment .* in page .*;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/search_pattern_in_file.inc
SET GLOBAL innodb_fast_shutdown= 0;
--echo # Fail to free the segment while freeing the used segments
let $restart_parameters=--debug_dbug=d,unused_undo_free_fail_5;
--source include/restart_mysqld.inc
SELECT IF(file_size>10485760,'ok',file_size) FROM information_schema.innodb_sys_tablespaces WHERE space=0;
let SEARCH_PATTERN= InnoDB: :autoshrink failed to free the segment .* in page .*;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/search_pattern_in_file.inc
SET GLOBAL innodb_fast_shutdown= 0;
let $restart_parameters=;
--source include/restart_mysqld.inc
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;
--echo # Fail to reset the TRX_SYS_FSEG_HEADER during undo tablespace
--echo # reinitialization. garbage_collect() shouldn't free the
--echo # TRX_SYS_FSEG_HEADER index node
set global innodb_fast_shutdown=0;
let $restart_parameters=--innodb_undo_tablespaces=2 --debug_dbug=d,sys_fseg_header_fail;
--source include/restart_mysqld.inc
let SEARCH_PATTERN= InnoDB: :autoshrink freed the segment .* in page .*;
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
--source include/search_pattern_in_file.inc
let $restart_parameters=;
set global innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0;

View File

@ -39,7 +39,7 @@ EOF
--source include/start_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN= Restoring page \[page id: space=1, page number=0\] of datafile '.*undo001' from the doublewrite buffer.;
let SEARCH_PATTERN= Recovered page \\[page id: space=1, page number=0\\] to '.*undo001' from the doublewrite buffer\\.;
--source include/search_pattern_in_file.inc
check table t1;

View File

@ -0,0 +1,98 @@
--source include/have_innodb.inc
--source include/count_sessions.inc
--source include/have_debug.inc
--source include/have_sequence.inc
SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
@@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
# Make sure there is no dynamic memory allocation during getting offsets for
# 32 columns of secondary index with 32 columns of primary index in
# lock_rec_unlock_unmodified().
DELIMITER $$;
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'CREATE TABLE t1(pk',
GROUP_CONCAT(seq SEPARATOR ' INT, pk'), ' INT, a',
GROUP_CONCAT(seq SEPARATOR ' INT, a'), ' INT, b',
GROUP_CONCAT(seq SEPARATOR ' INT, b'), ' INT, c INT, PRIMARY KEY(pk',
GROUP_CONCAT(seq SEPARATOR ', pk'), '), INDEX i1(a',
GROUP_CONCAT(seq SEPARATOR ', a'), '), INDEX i2(b',
GROUP_CONCAT(seq SEPARATOR ', b'), ')) ENGINE=InnoDB;')
FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'INSERT INTO t1 VALUES (',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',0), (',
GROUP_CONCAT('3' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('1' SEPARATOR ','), ',0), (',
GROUP_CONCAT('4' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',',
GROUP_CONCAT('2' SEPARATOR ','), ',0);')
FROM seq_1_to_32);
EXECUTE IMMEDIATE c;
END;
$$
DELIMITER ;$$
SET @old_timeout= @@GLOBAL.innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout= 1;
XA START "t1";
UPDATE t1 FORCE INDEX (i2) SET c=c+1 WHERE a1=1 AND b1=1;
XA END "t1";
# If there is dynamic memory allocation during getting offsets for
# 32 columns of secondary index with 32 columns of primary index in
# lock_rec_unlock_unmodified(), the following statement will cause assertion
# failure in debug build.
XA PREPARE "t1";
--connect(con1,localhost,root,,)
# (pk, 2, 1, 0) record is X-locked but not modified in clustered index with the
# above XA transaction, if the bug is not fixed, the following SELECT will be
# blocked by the XA transaction if XA PREPARE does not release the unmodified
# record.
SELECT a1, b1, c FROM t1 FORCE INDEX (i1) WHERE a1=2 AND b1=1 FOR UPDATE;
--disconnect con1
--connection default
XA COMMIT "t1";
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
@old_innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_lock_wait_timeout= @old_timeout;
# Check that we can't create secondary index with more than 32 columns.
DELIMITER $$;
--error ER_TOO_MANY_KEY_PARTS
BEGIN NOT ATOMIC
DECLARE c TEXT DEFAULT(
SELECT CONCAT(
'ALTER TABLE t1 ADD COLUMN d',
GROUP_CONCAT(seq SEPARATOR ' INT, ADD COLUMN d'),
' INT, ADD INDEX i3(d',
GROUP_CONCAT(seq SEPARATOR ', d'), ');')
FROM seq_1_to_33);
EXECUTE IMMEDIATE c;
END;
$$
DELIMITER ;$$
DROP TABLE t1;
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1 @@
--innodb_purge_threads=1

View File

@ -0,0 +1,86 @@
--source include/have_innodb.inc
--source include/count_sessions.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
SET @old_innodb_enable_xap_unlock_unmodified_for_primary_debug=
@@GLOBAL.innodb_enable_xap_unlock_unmodified_for_primary_debug;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug= 1;
SET @saved_dbug = @@GLOBAL.debug_dbug;
CREATE TABLE t(id INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
--let $i = 2
while ($i) {
--source include/wait_all_purged.inc
INSERT INTO t VALUES (10), (20), (30);
--connect(prevent_purge,localhost,root,,)
start transaction with consistent snapshot;
--connection default
DELETE FROM t WHERE id = 20;
SET @@GLOBAL.debug_dbug=
"+d,enable_row_purge_remove_clust_if_poss_low_sync_point";
# Cover both lock_release_on_prepare() and lock_release_on_prepare_try()
# functions
if ($i == 1) {
SET @@GLOBAL.debug_dbug="+d,skip_lock_release_on_prepare_try";
}
XA START '1';
UPDATE t SET id=40 WHERE id=30;
XA END '1';
--connection prevent_purge
COMMIT;
# stop purge worker after it requested page X-latch, but before
# lock_update_delete() call
SET DEBUG_SYNC=
'now WAIT_FOR row_purge_remove_clust_if_poss_low_before_delete';
SET @@GLOBAL.debug_dbug=
"-d,enable_row_purge_remove_clust_if_poss_low_sync_point";
--connection default
# lock_rec_unlock_unmodified() is executed either under lock_sys.wr_lock() or
# under a combination of lock_sys.rd_lock() + record locks hash table cell
# latch. Stop it before page latch request.
SET DEBUG_SYNC=
"lock_rec_unlock_unmodified_start SIGNAL lock_sys_latched WAIT_FOR cont";
--send XA PREPARE '1'
--connection prevent_purge
# let purge thread to continue execution and invoke lock_update_delete(),
# which, in turns, requests locks_sys related latches.
SET DEBUG_SYNC= 'now SIGNAL row_purge_remove_clust_if_poss_low_cont';
SET DEBUG_SYNC= 'now SIGNAL cont';
--disconnect prevent_purge
--connection default
# deadlock if the bug is not fixed, as lock_rec_unlock_unmodified() requests
# page latch acquired by purge worker, and the purge worker requests lock_sys
# related latches in lock_update_delete() call, acquired by the current XA
# in lock_rec_unlock_unmodified() caller.
--reap
XA COMMIT '1';
SET DEBUG_SYNC="RESET";
TRUNCATE TABLE t;
--dec $i
}
SET @@GLOBAL.debug_dbug = @saved_dbug;
DROP TABLE t;
SET GLOBAL innodb_enable_xap_unlock_unmodified_for_primary_debug=
@old_innodb_enable_xap_unlock_unmodified_for_primary_debug;
--source include/wait_until_count_sessions.inc