MDEV-41877 Partition function error still writes the row on MyISAM #6243
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.45) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 405 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.359
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #6243"
general
weight: 0.35
gkodinov
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.