Bug #103652 The data of dynamic metadata table lost
Submitted: 11 May 2021 9:53 Modified: 11 May 2021 10:53
Reporter: songlei wang Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:8.0.24 OS:Any
Assigned to: CPU Architecture:Any

[11 May 2021 9:53] songlei wang
Description:
The function 'MetadataRecover::store' will be called instead of function 'MetadataRecover::apply' if srv_log_file_size or srv_n_log_files have changed in processing of recovery.

The redo log stored in MetadataRecover object is used to override the table 'dynamic metadata' directly in the function 'MetadataRecover::store'. 
The redo log is only part of the data (autoinc or corrupted index) for a table, it will make the original data stored in 'dynamic metadata'  lost.

How to repeat:
Step as follows:
1. Make a table index corrupted 
2. insert some data with auto_increment
3. kill the mysqld
4. edit the cnf and change srv_log_file_size or srv_n_log_files
5. restart
6. The corrupted index will be OK due to the data in 'dynamic metadata' has been overridden.

Suggested fix:
Before replacing the table, apply the redo log of MLOG_TABLE_DYNAMIC_META in memory first.
[11 May 2021 9:53] songlei wang
mysql-test case

Attachment: zzzz.test (application/octet-stream, text), 1.12 KiB.

[11 May 2021 9:54] songlei wang
The case zzzz.test needs debug version
[11 May 2021 10:53] MySQL Verification Team
Hello songlei wang,

Thank you for the report.

regards,
Umesh