Repository navigation
Conversation
An integer overflow in a partition function, for example HASH (-a) with a = -9223372036854775808, raises ER_DATA_OUT_OF_RANGE but does not set null_value. part_val_int() checked thd->is_error() only when null_value was set, so it returned 0 as a valid value. The row went to the partition for 0 and the statement ended with the error already in the diagnostics area. MyISAM kept the row, or the new value on UPDATE. On a debug build my_ok() hit the assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())` in Diagnostics_area::set_ok_status(). Check thd->is_error() in part_val_int() regardless of null_value, so the row is not written. In ha_partition::is_fatal_error(), do not treat HA_ERR_NO_PARTITION_FOUND as ignorable when an error is already set, so INSERT IGNORE fails instead of skipping the row and sending OK. In ha_partition::print_error(), do not add "Table has no partition for value" on top of the existing error. Add a test to main.partition. 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. Assisted-by: Claude:claude-opus-5.5
FarihaIS
marked this pull request as ready for review
November 26, 2026 20:40
gkodinov
approved these changes
Nov 27, 2026
gkodinov
left a comment
Member
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
LGTM. Please stand by for the final review.
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 |
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
An integer overflow in a partition function, for example
HASH (-a)witha = -9223372036854775808, raisesER_DATA_OUT_OF_RANGEbut does not setnull_value.part_val_int()checkedthd->is_error()only whennull_valuewas set, so it returned 0 as a valid value. The row went to the partition for 0 and the statement ended with the error already in the diagnostics area. MyISAM kept the row, or the new value on UPDATE. On a debug buildmy_ok()hit the assertion!is_set() || (m_status == DA_OK_BULK && is_bulk_op())inDiagnostics_area::set_ok_status().Check
thd->is_error()inpart_val_int()regardless ofnull_value, so the row is not written. Inha_partition::is_fatal_error(), do not treatHA_ERR_NO_PARTITION_FOUNDas ignorable when an error is already set, soINSERT IGNOREfails instead of skipping the row and sending OK. Inha_partition::print_error(), do not add "Table has no partition for value" on top of the existing error.Add a test to
main.partition.Release Notes
N/A
How can this PR be tested?
Execute
main.partitionin mysql-test-run, with and without--ps-protocol.This commit adds a test to
main.partitionthat runsINSERT, multi-rowINSERT,INSERT IGNORE,REPLACEandUPDATEon MyISAM tables whose partition function overflows.ER_DATA_OUT_OF_RANGE, that no row or new value is stored, and thatSHOW WARNINGSlists only that error.Before the fix
On a debug build, running
main.partitionfails as below:After the fix
Running
main.partitionsucceeds:With
--ps-protocol:Basing 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.