Bug #97568 Innodb crash recovery replay rename operation check rename validate wrong
Submitted: 9 Nov 2019 15:48 Modified: 12 Dec 2019 15:01
Reporter: zechao zhuang Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:8.0.13 OS:CentOS
Assigned to: CPU Architecture:Any

[9 Nov 2019 15:48] zechao zhuang
Description:
When Innodb doing crash recovery, and replay a rename operation, we can see the function fil_op_replay_rename():

/* In order to replay the rename, the following must hold:
  1. The new name is not already used.
  2. A tablespace exists with the old name.
  3. The space ID for that tablepace matches this log entry.
  This will prevent unintended renames during recovery. */

Datafile df;
std::string name{new_name};
df.set_filepath(name.c_str()); //May be this name set wrong, Should be old_name?

dberr_t err = fil_rename_validate(space, old_name, df);

I read the code of fil_rename_validate function, this function want to check the old name ibd file is correct, that's mean the space id in the redo log is equal with space id in old name ibd file first page.

But the Datafile df set the file path use the new name, not the old name, so fil_rename_validate will try to open the file use the new name. By default, the new name ibd  file was not exist, so the check will return a DB_TABLESPACE_NOT_FOUND, and the check will be ok. But if the new name table space ibd file was already exist,  the check will be failed, because the space id in the redo log is mismatch with space id in the new name ibd file.

How to repeat:
Just read the code.

Suggested fix:
Use the old name to validate the space id in the redo log and ibd file, instead of new name.
[9 Nov 2019 15:56] zechao zhuang
Update the Version to 8.0.13.
[11 Nov 2019 16:09] Sinisa Milivojevic
Hi Mr. zhuang,

Thank you for your bug report.

However, in order that we an process your  report further, we shall need some further info from you.

First of all, current version is not 8.0.13, but 8.0.18. Hence, try whether you experience the same problem with 8.0.18.

Second, your description of the problem is very unclear. Can you try to rephrase your description in the more understandable manner.

Third, if you are referring to our code, please refer to the source code file, function name and range of the line numbers in 8.0.18.

Thanks in advance.
[12 Dec 2019 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".