Repository navigation
Use Split Update when partition key is updated and expand is in progress - #2374
Open
andr-sokolov wants to merge 3 commits into
Open
andr-sokolov wants to merge 3 commits into
andr-sokolov wants to merge 3 commits into
Conversation
andr-sokolov
force-pushed
the
check_splitupdate
branch
from
November 20, 2026 07:54
c6e36cd to
5a5f565
Compare
andr-sokolov
marked this pull request as ready for review
November 20, 2026 08:15
Member
|
As I understand it, we have just got a bug report instead of copying their code. Is that right? If so, all looks good. |
Collaborator
Author
yes, their code is not copied |
Vlasdislav
reviewed
Nov 20, 2026
Vlasdislav
reviewed
Nov 20, 2026
Collaborator
|
Hi, thanks for the fix! I tested commit 482abcb with the Postgres planner on a three-segment cluster with assertions enabled and found the following issues:
The MERGE updates 20 rows, but reports MERGE 40 instead of MERGE 20. The subsequent SELECT correctly returns 20. It looks like both the DELETE and INSERT halves of each split UPDATE are counted.
This additional lock is held until the transaction ends and can conflict with an ACCESS EXCLUSIVE lock on the pruned partition. |
Alena0704
self-requested a review
November 20, 2026 14:19
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.
When a partitioned table is distributed by key, and ALTER TABLE ... EXPAND
PARTITION PREPARE has been executed, and some partitions have already been
reorganized, but some have not, the distribution of the partitions is different.
In this case we should use Split Update when partition key is updated because
the table rows may be moved across segments.
There is no need to use Split Update when the table is distributed randomly, so
the check for nattrs is added at the beginning of check_splitupdate.
The bug led to missing rows when joining tables. Queries to reproduce the bug
are added to the tests.
The bug report is got from PR warehouse-pg/warehouse-pg#391