Repository navigation
MDEV-41989 : Fix duplicate key error code on cross-partition update - #6049
Open
girihimanshu540-prog wants to merge 2 commits into
Open
girihimanshu540-prog wants to merge 2 commits into
girihimanshu540-prog wants to merge 2 commits into
Conversation
girihimanshu540-prog
force-pushed
the
fix-mdev-41989
branch
from
November 2, 2026 05:43
4d760e6 to
4641beb
Compare
gkodinov
requested changes
Nov 2, 2026
gkodinov
left a comment
Member
There was a problem hiding this comment.
Thank you for your contribution! This is a preliminary review.
Couple of things to fix:
- Please keep just one commit: fwiw, github can do merges with rebase. Please use that
- Please add a commit message to your commit
- We fix errors in the lowest affected version. In this case I'd suggest 11.4 since this is just a readability improvement and not something so critical that it'd warrant a fix in 10.11 (IMHO).
- the issues mentioned below: buildbot must be clean.
| } | ||
|
|
||
|
|
||
| uint32 saved_last_part= m_last_part; |
Member
There was a problem hiding this comment.
move this to the top of the function to fix the following compile error:
/home/buildbot/aarch64-debian-12/build/sql/ha_partition.cc: In member function ‘virtual int ha_partition::update_row(const uchar*, const uchar*)’:
/home/buildbot/aarch64-debian-12/build/sql/ha_partition.cc:4759:1: error: jump to label ‘exit’
4759 | exit:
| ^~~~
/home/buildbot/aarch64-debian-12/build/sql/ha_partition.cc:4716:10: note: from here
4716 | goto exit;
| ^~~~
/home/buildbot/aarch64-debian-12/build/sql/ha_partition.cc:4719:10: note: crosses initialization of ‘uint32 saved_last_part’
4719 | uint32 saved_last_part= m_last_part;
| ^~~~~~~~~~~~~~~
/home/buildbot/aarch64-debian-12/build/sql/ha_partition.cc:4759:1: error: jump to label ‘exit’
4759 | exit:
| ^~~~
/home/buildbot/aarch64-debian-12/build/sql/ha_partition.cc:4712:10: note: from here
4712 | goto exit;
| ^~~~
/home/buildbot/aarch64-debian-12/build/sql/ha_partition.cc:4719:10: note: crosses initialization of ‘uint32 saved_last_part’
4719 | uint32 saved_last_part= m_last_part;
| ^~~~~~~~~~~~~~~
make[2]: *** [sql/CMakeFiles/partition.dir/build.make:76: sql/CMakeFiles/partition.dir/ha_partition.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:11024: sql/CMakeFiles/partition.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
| @@ -0,0 +1,5 @@ | |||
| CREATE TABLE t1 (id INT PRIMARY KEY, a INT) ENGINE=MyISAM PARTITION BY HASH (id) PARTITIONS 2; | |||
Member
There was a problem hiding this comment.
Move this test into the relevant partitioning suite and pick a file to put it in that's testing similar things.
Or keep it in a separate file, but prefix it with
--echo #
--echo # MDEV-41989: Fix duplicate key error code on cross-partition update - #6049
--echo #
And suffix it with
--echo End of 11.4 tests
Also, make sure to use the following at the top (as the rest of the part suite files do):
# The server must support partitioning.
--source include/have_partition.inc
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.
#Jira: https://mariadb.org
Fixes: MDEV-41989
Description
Fixes a duplicate key handling regression where a cross-partition row update incorrectly returns
ERROR 1022 (Can't write; duplicate key in table)instead of the expectedERROR 1062 (Duplicate entry...).Fix
Introduced a variable
saved_last_partto preserve the initialm_last_partcontext prior to updating the bulk insert partition state. Ifha_update_row()encounters a failure within the cross-partition routine, the initial state is restored to ensure the error subsystem correctly references the expected table handler, properly returningER_DUP_ENTRY.