feat: Improve innodb_redo_log_capacity recommendation #849
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 commit implements a more intelligent recommendation for the
innodb_redo_log_capacity
variable for MySQL versions 8.0.30 and newer.The previous recommendation was based on a simple percentage of the
innodb_buffer_pool_size
, which was often inaccurate. The new logic calculates the hourly InnoDB log write rate based on theInnodb_os_log_written
status variable and the server's uptime. It then suggests a value forinnodb_redo_log_capacity
that can hold at least one hour's worth of writes, rounded up to a practical power-of-2 GB value.A sanity check is also included to prevent recommending an excessively large redo log compared to the total size of the InnoDB data.
For older MySQL and MariaDB versions, the existing logic for
innodb_log_file_size
andinnodb_log_files_in_group
is preserved.A new helper function
hr_bytes_practical_rnd
has been added to handle the rounding of the suggested size.Fixes #784