Contrib Fake PR: Testing Patch for Bug#115988 - Too Much Disk Read on Startup, penalizing deployments with many tables (1M+) #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains a testing patch for reducing the amount of data read from disk during MySQL startup. When enabling the testing flags (
innodb_tablespace_startup_testing_fadvise
andinnodb_tablespace_startup_testing_light
, disabled by default), the amount of data read per table on startup is divided by 8 (32 kb to 4 kb), which reduces MySQL startup time from 2:39 to 1:09 (1 minute 9 seconds).This is a "Contrib Fake PR". It is there so people can comment on this work in case it needs adjustments. This has be contributed on 2024-09-03 as a patch file in Bug#115988. More about this in a previous RFC blog post, section Fake PRs and my Way of Working on MySQL Contributions.
This PR merges on 9.0.1, and the corresponding patch file applies to 8.4.2 and 8.0.39. Because this PR significantly improves MySQL startup, I think it should be back ported to 8.0 and 8.4, and if it is considered a "breaking change", with feature flags / global variables to enable the optimizations, disabled by default.
The analysis of the problems addressed by this PR can be found in Bug#115988: Too Much Disk Read on Startup, penalizing deployments with many tables (1M+).
This PR introduces two testing flags / global variables, disabled by default:
innodb_tablespace_startup_testing_fadvise
andinnodb_tablespace_startup_testing_light
. They allow enabling the optimizations introduced by this PR. When merging in 9.0, I assumed it did not make sense to keep these, hence "testing" naming and limited documentation. If it is decided they are needed, they should be renamed and documented adequately, which I can do if asked by Oracle.While doing this work, I "played with fire" and refactored a few things. They are identified as "I / JFG had a visceral reaction ..." as comments in the code. These and other comments are in the code for the clarity of the PR, they should be removed / adjusted when merging.
And one last thing: the "light" optimization will probably not work on filesystems that have a 16-kilobyte block size (like a deployment on zfs). This means that when avoiding the overhead of the double write buffer, one will have to pay an overhead on startup. As usual, every optimization has a tradeoff ¯_(ツ)_/¯.