mariadb/mysql-test/suite/innodb/r/alter_kill.result
Marko Mäkelä 759e3523e3 MDEV-38026 Recovery of FILE_CREATE fails to create a file
fil_ibd_create(): Add a DEBUG_SYNC point for the test case.

fil_node_open_file_low(): If node->deferred is set, set the
OS_FILE_ON_ERROR_SILENT flag on OS_FILE_OPEN and attempt
OS_FILE_CREATE if needed. If this fails, then InnoDB will
refuse to start up, giving the operator a chance to resolve
the situation, for example by freeing up some space in the
file system.

recv_validate_tablespace(): Invoke deferred_spaces.add() on
any missing tablespace for which we know the LSN of the FILE_CREATE
record. In this way, fil_node_open_file_low() will end up being invoked
on files that are supposed to be created.

fil_name_process(): For FILE_CREATE, remember the create_lsn.

recv_sys_t::parse(): Pass FILE_CREATE to fil_name_process().

Some existing tests have been adjusted for the improved recovery of
file creation.

Reviewed by: Thirunarayanan Balathandayuthapani
Tested by: Saahil Alam
2025-11-07 08:09:08 +02:00

66 lines
1.9 KiB
Text

#
# Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP
#
SET GLOBAL innodb_file_per_table=1;
SET GLOBAL innodb_stats_persistent=0;
CREATE TABLE bug16720368_1 (a INT PRIMARY KEY) ENGINE=InnoDB;
connect con1,localhost,root;
CREATE TABLE bug16720368 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO bug16720368 (a) VALUES (1),(2),(3),(4),(5),(6),(7),(8);
InnoDB 0 transactions not purged
connection default;
# Cleanly shutdown mysqld
disconnect con1;
# Corrupt FIL_PAGE_TYPE in bug16720368.ibd,
# and recompute innodb_checksum_algorithm=crc32
# restart
SELECT COUNT(*) FROM bug16720368;
ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
INSERT INTO bug16720368 VALUES(1);
ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine
INSERT INTO bug16720368_1 VALUES(1);
# Shut down the server to uncorrupt the data.
# restart
INSERT INTO bug16720368 VALUES(9,1);
SELECT COUNT(*) FROM bug16720368;
COUNT(*)
9
DROP TABLE bug16720368, bug16720368_1;
#
# Bug#16735660 ASSERT TABLE2 == NULL, ROLLBACK OF RESURRECTED TXNS,
# DICT_TABLE_ADD_TO_CACHE
#
SET GLOBAL innodb_file_per_table=1;
CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 VALUES(42);
connect con1,localhost,root;
CREATE TABLE bug16735660 (a INT PRIMARY KEY) ENGINE=InnoDB;
SET GLOBAL innodb_max_purge_lag_wait=2;
SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0;
SET GLOBAL innodb_max_dirty_pages_pct=0.0;
SET GLOBAL innodb_max_dirty_pages_pct=90.0;
XA START 'x';
INSERT INTO bug16735660 VALUES(1),(2),(3);
XA END 'x';
XA PREPARE 'x';
connection default;
# Kill the server
disconnect con1;
# Attempt to start without an *.ibd file.
# restart
FOUND 1 /\[ERROR\] InnoDB: Tablespace [0-9]+ was not found at .*test.bug16735660.ibd/ in mysqld.1.err
# restart
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT * FROM bug16735660;
a
1
2
3
XA RECOVER;
formatID gtrid_length bqual_length data
1 1 0 x
XA ROLLBACK 'x';
SELECT * FROM bug16735660;
a
DROP TABLE bug16735660;