mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-31 15:50:51 +03:00 
			
		
		
		
	If InnoDB crash recovery was needed, the InnoDB function srv_start() would invoke extra validation, reading something from every InnoDB data file. This should be unnecessary now that MDEV-14717 made RENAME operations crash-safe inside InnoDB (which can be disabled in MariaDB 10.2 by setting innodb_safe_truncate=OFF). dict_check_sys_tables(): Skip tables that would be dropped by row_mysql_drop_garbage_tables(). Perform extra validation only if innodb_safe_truncate=OFF, innodb_force_recovery=0 and crash recovery was needed. dict_load_table_one(): Validate the root page of the table. In this way, we can deny access to corrupted or mismatching tables not only after crash recovery, but also after a clean shutdown.
		
			
				
	
	
		
			59 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| #
 | |
| # Bug#16720368 INNODB CRASHES ON BROKEN #SQL*.IBD FILE AT STARTUP
 | |
| #
 | |
| SET GLOBAL innodb_file_per_table=1;
 | |
| 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);
 | |
| connection default;
 | |
| # Cleanly shutdown mysqld
 | |
| disconnect con1;
 | |
| # Corrupt FIL_PAGE_OFFSET in bug16720368.ibd,
 | |
| # and recompute innodb_checksum_algorithm=crc32
 | |
| # Restart mysqld
 | |
| 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 the server after uncorrupting the file.
 | |
| 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;
 | |
| 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.
 | |
| FOUND 1 /\[ERROR\] InnoDB: Tablespace [0-9]+ was not found at .*test.bug16735660.ibd/ in mysqld.1.err
 | |
| 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;
 |