Bug #101331 file path constructing use space_name instead of table_name
Submitted: 27 Oct 2020 5:48 Modified: 28 Oct 2020 18:04
Reporter: Li Zhong Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[27 Oct 2020 5:48] Li Zhong
Description:
In storage/innobase/fil/fil0fil.cc: fil_ibd_open(), line 5621-5616:
  if (path_in == nullptr) {
    df.make_filepath(nullptr, space_name, IBD);
  } else {
    df.set_filepath(path_in);
  }

In 
df.make_filepath(nullptr, space_name, IBD);

It seems like space_name should be table_name instead because table_name is what should be used in constructing file path. So I wonder whether it's a bug.

How to repeat:
In mysql-8.0.21 source code
[27 Oct 2020 14:50] MySQL Verification Team
Hi Mr. Zhong,

Thank you for your bug report.

However, this is not a bug.

Variable `table_name` can not be used instead of `space_name`. First variable is sometimes a NULL pointer and much more often contains the relative path, not just the tablespace name.

Not a bug.
[28 Oct 2020 18:04] Li Zhong
Thanks for your reply! 

However, in this case, the parameter table_name is unused in fil_ibd_open(), which is a violation to the comment of its use:

@param[in]      table_name: the databasename/tablename format table name in case if need to construct file path

If table_name is really useless here, I wonder whether it's necessary to add MY_ATTRIBUTE(unused) here?
[29 Oct 2020 12:30] MySQL Verification Team
Hi,

This parameter will be used in the future.