Skip to content

MDEV-40840 InnoDB: Failing assertion: stat_value != UINT64_UNDEFINED - #5585

Open
amodhakal wants to merge 1 commit into
MariaDB:11.4from
amodhakal:mdev-40840
Open

amodhakal wants to merge 1 commit into
MariaDB:11.4from
amodhakal:mdev-40840

Conversation

@amodhakal

@amodhakal amodhakal commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

dict_stats_fetch_index_stats_step() uses UINT64_UNDEFINED (18446744073709551615) as a sentinel for missing stats, but nothing stopped a user from writing that exact value into mysql.innodb_index_stats.stat_value, causing an assertion failure.

Add a CHECK constraint, innodb_index_stats_stat_value_defined, rejecting the sentinel value on write, and an MTR test covering the repro.

Fixes https://jira.mariadb.org/browse/MDEV-40840

@mariadb-RoelVandePaar mariadb-RoelVandePaar added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Aug 24, 2026

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! This is a preliminary review.

My recommendation is to please consider making the info printing an error. What good is it to silently ignore values that the user supplied?

But, I'll leave this to the final reviewer. Formally, it's ok to push as is.
Please stand by for the final review.

Comment thread storage/innobase/dict/dict0stats.cc Outdated
@gkodinov gkodinov removed their assignment Aug 24, 2026
@gkodinov

Copy link
Copy Markdown
Member

FYI: According to our development cycle we work on bugs In the following periods 15 Mar-30 Apr, 15 Jun-30 Jul, 15 Sep-30 Oct and 15 Dec-31 Jan. So, please, expect to get a review somewhere between these two dates and the goal is to have your PR merged before the second date

@amodhakal
amodhakal marked this pull request as draft August 25, 2026 16:36
@amodhakal
amodhakal force-pushed the mdev-40840 branch 9 times, most recently from 2139296 to 4a84e55 Compare August 28, 2026 05:41
@amodhakal
amodhakal force-pushed the mdev-40840 branch 3 times, most recently from 212e778 to 7bcd802 Compare September 2, 2026 00:03
@amodhakal
amodhakal marked this pull request as ready for review September 2, 2026 00:18
@amodhakal
amodhakal requested a review from gkodinov September 2, 2026 00:19

@gkodinov gkodinov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please stand by for the final review.

@amodhakal
amodhakal force-pushed the mdev-40840 branch 3 times, most recently from 0a594d4 to 070a546 Compare September 7, 2026 21:31
@amodhakal
amodhakal force-pushed the mdev-40840 branch 2 times, most recently from 429fa63 to 8c7e885 Compare September 16, 2026 18:41

@Thirunarayanan Thirunarayanan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase the branch to 11.4
Can't we have simple statement like

 alter table innodb_index_stats add constraint if not exists innodb_index_stats_stat_value_defined check (stat_value <> 18446744073709551615);

Comment thread scripts/mariadb_system_tables_fix.sql Outdated
@amodhakal
amodhakal changed the base branch from 10.11 to 11.4 October 17, 2026 13:44
dict_stats_fetch_index_stats_step() uses UINT64_UNDEFINED
(18446744073709551615) as a sentinel for missing stats, but nothing
stopped a user from writing that exact value into
mysql.innodb_index_stats.stat_value, causing an assertion failure.

Add a CHECK constraint, innodb_index_stats_stat_value_defined,
rejecting the sentinel value on write, and an MTR test covering
the repro.

Signed-off-by: Amodh Dhakal <amodhakal@gmail.com>
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