Description:
Hi,
when reading code to understand Long MySQL Startups with Many Tables (more about why I ended up there in [1]), I saw the function rename_partition_files [2] between the startup phase "InnoDB Directories Scanning" and "InnoDB Tablespace Duplicate Check" (the phase names are my own, more about them in [3] which is a "section" direct-link in [1]).
[1]: https://jfg-mysql.blogspot.com/2024/11/long-and-silent-stressful-mysql-startup.html
[2]: https://github.com/mysql/mysql-server/blob/mysql-9.1.0/storage/innobase/fil/fil0fil.cc#L11...
[3]: https://jfg-mysql.blogspot.com/2024/11/long-and-silent-stressful-mysql-startup.html#phases
From what I understand, the function rename_partition_files is legacy code, introduced in MySQL 8.0.19 for WL#13352 (link to commit in [4]). Also from what I understand, an upgrade from MySQL 8.0 to MySQL 9 is not supported, so I think the function rename_partition_files, and more, should not be in MySQL 9. Also, maybe this should not even have been in MySQL 8.4, but it is too late for that, and because upgrading to 8.4 from "before" 8.0.19 needs to work, it might be a good thing that this is in 8.4.
[4]: https://github.com/mysql/mysql-server/commit/916268990654
I wrote "and more" in the title and in the paragraph above, because migrating to "Case insensitive names for partition tables" (the title of WL#13352 mentioned in the paragraph above) impacts more places in the code. The call to the function fil_update_partition_name [5] is an example. Other examples can be found in the commit of WL#13352 [4].
[5]: https://github.com/mysql/mysql-server/blob/mysql-9.1.0/storage/innobase/handler/ha_innodb....
I am filing this as S2 / Serious, because I think cleaning-up legacy code is not a minor thing. Also, this legacy code is making optimizing startup more complicated than it should (I was looking at implementing "parallelize [pipelining] the scan and ID check" [6], but rename_partition_files is in my way).
[6]: https://github.com/mysql/mysql-server/blob/mysql-9.1.0/storage/innobase/fil/fil0fil.cc#L11...
And one last thing: I have mixed and somehow negative feelings about this function being called each time MySQL starts. IMHO, this should only have been done at upgrade-time. It is too late for fixing this, but please consider making similar processing “upgrade-only”.
Many thanks for looking into this,
Jean-François Gagné
How to repeat:
This is not as much a "repeatable" bug as it is a "legacy code cleanup" which looks as it was forgotten.
To "repeat" / verify this bug, look at WL#13352 and its commit [4]. Also look at the calls to the functions rename_partition_files [2] and fil_update_partition_name [5], which IMHO are 2 examples of processing that are not needed in MySQL 9 (and cluttering startup).
[4]: https://github.com/mysql/mysql-server/commit/916268990654
[2]: https://github.com/mysql/mysql-server/blob/mysql-9.1.0/storage/innobase/fil/fil0fil.cc#L11...
[5]: https://github.com/mysql/mysql-server/blob/mysql-9.1.0/storage/innobase/handler/ha_innodb....