Skip to content
/ server Public

MDEV-38936 Proactive handling of InnoDB tablespace full condition#4721

Open
FarihaIS wants to merge 1 commit intoMariaDB:mainfrom
FarihaIS:mdev-38936
Open

MDEV-38936 Proactive handling of InnoDB tablespace full condition#4721
FarihaIS wants to merge 1 commit intoMariaDB:mainfrom
FarihaIS:mdev-38936

Conversation

@FarihaIS
Copy link
Contributor

@FarihaIS FarihaIS commented Mar 2, 2026

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 exceed 90% of a configurable threshold. Warnings appear at each percentage point (90%, 91%, 92%, etc.) to prevent log flooding.

Key features:

  • Two new system variables: innodb_tablespace_size_warning_threshold (default 16TB) and innodb_tablespace_size_warning_enabled (andon cord)
  • Per-tablespace tracking with automatic reset on TRUNCATE/DROP
  • 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 9 bytes per tablespace (m_last_size_warning_pct, m_last_warning_threshold) to fil_space_t structure.

Release Notes

Added proactive InnoDB tablespace size monitoring to prevent filesystem size limit failures. Two new system variables allow configuring warning thresholds and enable/disable functionality.

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 expected behavior is to emit warnings in the error log when a tablespace grows beyond 90% of the configured threshold:

[Warning] InnoDB: Tablespace 'test/t1' size 9437184 bytes (90%) exceeds warning threshold of 10485760 bytes
[Warning] InnoDB: Tablespace 'test/t1' size 9543680 bytes (91%) exceeds warning threshold of 10485760 bytes

Basing the PR against the correct MariaDB version

  • This is a new feature, and the PR is based against the main branch.

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.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@grooverdan grooverdan added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 2, 2026
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
exceed 90% of a configurable threshold. Warnings appear at each
percentage point (90%, 91%, etc.) to prevent log flooding.

Key features:
- Two new system variables: innodb_tablespace_size_warning_threshold
  (default 16TB) and innodb_tablespace_size_warning_enabled (andon cord)
- Per-tablespace tracking with automatic reset on TRUNCATE/DROP
- 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 9 bytes per tablespace
(m_last_size_warning_pct, m_last_warning_threshold) 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.
@mikegriffin
Copy link
Contributor

Feature request, allow additional use cases (example, tablespace becomes larger than expected):

  • Make a configurable warning percent (tablespace_size_warning_pct) so warnings can start earlier without changing the byte threshold
  • Replace hard-coded 90 with a named constant (high_resolution_pct)
  • No change above high_resolution_pct: print on every 1% increase
  • Between tablespace_size_warning_pct and high_resolution_pct: print at most twice per 10% (example, 70%, 77%, 81%, 89%, 90%, 91%, 92%)

@FarihaIS FarihaIS marked this pull request as ready for review March 2, 2026 23:10
@Thirunarayanan Thirunarayanan requested review from dr-m and iMineLink March 3, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

4 participants