MDEV-38936 Proactive handling of InnoDB tablespace full condition#4721
Open
FarihaIS wants to merge 1 commit intoMariaDB:mainfrom
Open
MDEV-38936 Proactive handling of InnoDB tablespace full condition#4721FarihaIS wants to merge 1 commit intoMariaDB:mainfrom
FarihaIS wants to merge 1 commit intoMariaDB:mainfrom
Conversation
|
|
Contributor
|
Feature request, allow additional use cases (example, tablespace becomes larger than expected):
|
a1c335d to
64ab2ed
Compare
InnoDB write failures occur when tablespace files exceed filesystem size
limits. Current behavior logs errors but continues accepting
transactions, causing repeated failures and potential data integrity
issues.
Add proactive monitoring by emitting warnings when InnoDB tablespaces
approach a configurable size threshold. Warnings use a tiered frequency
approach to balance early notification with log spam prevention.
Key features:
- Three new system variables:
* innodb_tablespace_size_warning_threshold (default 16TB): Maximum
tablespace size in bytes before warnings begin
* innodb_tablespace_size_warning_pct (default 70%): Percentage of
threshold at which to start emitting warnings
* innodb_tablespace_size_warning_enabled (default ON): Andon cord to
enable/disable the warning feature
- Tiered warning frequency:
* Below warning_pct: No warnings
* Between warning_pct and 90%: At most twice per 10% interval with
minimum 5% gap (e.g., 70%, 77%, 81%, 89%)
* Above 90%: Every 1% increase (90%, 91%, 92%, etc.)
- Per-tablespace tracking with automatic reset on TRUNCATE/DROP or
threshold changes
- Zero overhead when disabled
- Progressive warnings capped at 100%
Implementation hooks into fsp_try_extend_data_file() for O(1) size
checking during tablespace extension. Adds 11 bytes per tablespace
(m_last_size_warning_pct, m_last_warning_threshold,
m_warning_count_in_decade) to fil_space_t structure.
All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
Contributor
Author
|
@mikegriffin I have just pushed some new changes. Could you please take a look and confirm whether the new implementation addresses the additional use cases you mentioned above? Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
InnoDB write failures occur when tablespace files exceed filesystem size limits (e.g. 16TB on ext4, 2TB on ext3 - varies by filesystem). Current behavior logs errors but continues accepting transactions, causing repeated failures, user disruption, and potential data integrity issues.
Add proactive monitoring by emitting warnings when InnoDB tablespaces approach a configurable size threshold. Warnings use a tiered frequency approach to balance early notification with log spam prevention.
Key features:
innodb_tablespace_size_warning_threshold(default 16TB): Maximumtablespace size in bytes before warnings begin
innodb_tablespace_size_warning_pct(default 70%): Percentage ofthreshold at which to start emitting warnings
innodb_tablespace_size_warning_enabled(default ON): Andon cord toenable/disable the warning feature
warning_pct: No warningswarning_pctand 90%: At most twice per 10% interval withminimum 5% gap (e.g., 70%, 77%, 81%, 89%)
TRUNCATE/DROPorthreshold changes
Implementation hooks into
fsp_try_extend_data_file()for O(1) size checking during tablespace extension. Adds 11 bytes per tablespace (m_last_size_warning_pct,m_last_warning_threshold,m_warning_count_in_decade) tofil_space_tstructure.Release Notes
Added proactive InnoDB tablespace size monitoring to prevent filesystem size limit failures. Three new system variables enable configurable warning thresholds with tiered warning frequency:
innodb_tablespace_size_warning_threshold(default 16TB): Maximum size before warningsinnodb_tablespace_size_warning_pct(default 70%): When to start warningsinnodb_tablespace_size_warning_enabled(default ON): Feature toggleWarnings use tiered frequency: none below threshold, at most twice per 10% between threshold and 90%, then every 1% above 90%. This provides early notification without flooding error logs.
How can this PR be tested?
Execute the innodb.tablespace_size_warning test in mysql-test-run. This commit adds a test in the innodb suite.
The test validates:
innodb_tablespace_size_warning_enabled)TRUNCATE TABLEresets warning stateExpected warning behavior in error log:
innodb_tablespace_size_warning_pct(default 70%): No warningsExample:
[Warning] InnoDB: Tablespace 'test/t1' size 7340032 bytes (70%) exceeds warning threshold of 10485760 bytesExample:
[Warning] InnoDB: Tablespace 'test/t1' size 8388608 bytes (77%) exceeds warning threshold of 10485760 bytesExample:
[Warning] InnoDB: Tablespace 'test/t1' size 9437184 bytes (90%) exceeds warning threshold of 10485760 bytesExample:
[Warning] InnoDB: Tablespace 'test/t1' size 9543680 bytes (91%) exceeds warning threshold of 10485760 bytesBasing the PR against the correct MariaDB version
Copyright
All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.