mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
34eef269eb
Always read full page 0 to determine does tablespace contain encryption metadata. Tablespaces that are page compressed or page compressed and encrypted do not compare checksum as it does not exists. For encrypted tables use checksum verification written for encrypted tables and normal tables use normal method. buf_page_is_checksum_valid_crc32 buf_page_is_checksum_valid_innodb buf_page_is_checksum_valid_none Modify Innochecksum logging to file to avoid compilation warnings. fil0crypt.cc fil0crypt.h Modify to be able to use in innochecksum compilation and move fil_space_verify_crypt_checksum to end of the file. Add innochecksum logging to file. univ.i Add innochecksum strict_verify, log_file and cur_page_num variables as extern. page_zip_verify_checksum Add innochecksum logging to file and remove unnecessary code. innochecksum.cc Lot of changes most notable able to read encryption metadata from page 0 of the tablespace. Added test case where we corrupt intentionally FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION (encryption key version) FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION+4 (post encryption checksum) FIL_DATA+10 (data)
45 lines
2 KiB
Text
45 lines
2 KiB
Text
SET GLOBAL innodb_file_format = `Barracuda`;
|
|
SET GLOBAL innodb_file_per_table = ON;
|
|
set global innodb_compression_algorithm = 1;
|
|
# Create and populate a tables
|
|
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
|
|
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
|
|
CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO;
|
|
CREATE TABLE t4 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1;
|
|
CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4;
|
|
CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB;
|
|
# Write file to make mysql-test-run.pl expect the "crash", but don't
|
|
# start it until it's told to
|
|
# We give 30 seconds to do a clean shutdown because we do not want
|
|
# to redo apply the pages of t1.ibd at the time of recovery.
|
|
# We want SQL to initiate the first access to t1.ibd.
|
|
# Wait until disconnected.
|
|
# Run innochecksum on t1
|
|
# Run innochecksum on t2
|
|
# Run innochecksum on t3
|
|
# Run innochecksum on t4
|
|
# Run innochecksum on t4
|
|
# Run innochecksum on t5
|
|
# Run innochecksum on t6
|
|
# Backup tables before corrupting
|
|
# Corrupt FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
|
|
# Run innochecksum on t2
|
|
# Run innochecksum on t3
|
|
# no encryption corrupting the field should not have effect
|
|
# Run innochecksum on t6
|
|
# no encryption corrupting the field should not have effect
|
|
# Restore the original tables
|
|
# Corrupt FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION+4 (post encryption checksum)
|
|
# Run innochecksum on t2
|
|
# Run innochecksum on t3
|
|
# Run innochecksum on t6
|
|
# no encryption corrupting the field should not have effect
|
|
# Restore the original tables
|
|
# Corrupt FIL_DATA+10 (data)
|
|
# Run innochecksum on t2
|
|
# Run innochecksum on t3
|
|
# Run innochecksum on t6
|
|
# Restore the original tables
|
|
# Write file to make mysql-test-run.pl start up the server again
|
|
# Cleanup
|
|
DROP TABLE t1, t2, t3, t4, t5, t6;
|