| 1 |
set global innodb_compression_algorithm = 1; |
| 2 |
# Create and populate a tables |
| 3 |
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=4; |
| 4 |
CREATE TABLE t2 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=YES ENCRYPTION_KEY_ID=4; |
| 5 |
CREATE TABLE t3 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED ENCRYPTED=NO; |
| 6 |
CREATE TABLE t4 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1; |
| 7 |
CREATE TABLE t5 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB PAGE_COMPRESSED=1 ENCRYPTED=YES ENCRYPTION_KEY_ID=4; |
| 8 |
CREATE TABLE t6 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT) ENGINE=InnoDB; |
| 9 |
# Run innochecksum on t1, check -S does not cause crash for encrypted file |
| 10 |
# Run innochecksum on t2 |
| 11 |
# Run innochecksum on t3 |
| 12 |
# Run innochecksum on t4 |
| 13 |
# Run innochecksum on t4 |
| 14 |
# Run innochecksum on t5 |
| 15 |
# Run innochecksum on t6 |
| 16 |
# Backup tables before corrupting |
| 17 |
# Corrupt FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION |
| 18 |
# Run innochecksum on t2 |
| 19 |
# Run innochecksum on t3 |
| 20 |
# no encryption corrupting the field should not have effect |
| 21 |
# Run innochecksum on t6 |
| 22 |
# In new checksum format, checksum calculated for whole page. |
| 23 |
# So It should affected. |
| 24 |
# Restore the original tables |
| 25 |
# Corrupt FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION+4 (post encryption checksum) |
| 26 |
# Run innochecksum on t2 |
| 27 |
# Run innochecksum on t3 |
| 28 |
# Run innochecksum on t6 |
| 29 |
# Space ID mismatch |
| 30 |
# Restore the original tables |
| 31 |
# Corrupt FIL_DATA+10 (data) |
| 32 |
# Run innochecksum on t2 |
| 33 |
# Run innochecksum on t3 |
| 34 |
# Run innochecksum on t6 |
| 35 |
# Restore the original tables |
| 36 |
# restart |
| 37 |
# Trigger AHI and test pages_hashed, pages_old as non zero from sys view |
| 38 |
SELECT STRAIGHT_JOIN COUNT(t6a.a) |
| 39 |
FROM t6 AS t6a, t6 AS t6b, t6 AS t6c |
| 40 |
WHERE t6a.a = t6b.a AND t6c.a = t6a.a; |
| 41 |
COUNT(t6a.a) |
| 42 |
1000 |
| 43 |
SELECT SUM(pages_hashed)>0 `1`, SUM(pages_old)>0 `1` |
| 44 |
FROM sys.innodb_buffer_stats_by_table; |
| 45 |
1 1 |
| 46 |
1 1 |
| 47 |
DROP TABLE t1, t2, t3, t4, t5, t6; |