[KYUUBI #7720][SERVER] Reconcile duplicate-key insert retries - #7721
Open
nnvscholar-collab wants to merge 1 commit into
Open
[KYUUBI #7720][SERVER] Reconcile duplicate-key insert retries#7721nnvscholar-collab wants to merge 1 commit into
nnvscholar-collab wants to merge 1 commit into
Conversation
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.
Why are the changes needed?
When a queued
InsertMetadataretry is replayed by the async retry trigger, it can hit a duplicate-key error if the original insert actually succeeded but its acknowledgement was lost.insertMetadataintentionally fails fast on duplicate-key errors, and since the retry loop only caught exceptions around the wholewhileblock, this exception escaped before the request could be removed from the queue — leaving it stuck at the head and blocking all later requests for that session indefinitely. This is the same amplification pattern reported in #7708 for updates, but for inserts (raised by @pan3793 during review of #7709).This patch verifies the postcondition inside the retry loop specifically: if a duplicate-key error occurs while retrying an insert, and a row matching the identifier, session type, and create time already exists, it's treated as an idempotent success and removed from the queue. The fail-fast behavior of
insertMetadata()itself is unchanged for direct/foreground calls.Closes #7720.
How was this patch tested?
Added a regression test verifying that a queued insert retry which hits a duplicate-key error is removed from the queue instead of blocking subsequent requests for the same session.
Ran:
build/mvn test -pl kyuubi-server -am -Pspark-provided,flink-provided,hive-provided -Dtest=none -DwildcardSuites=org.apache.kyuubi.server.metadata.MetadataManagerSuite
Was this patch assisted by generative AI tooling?
Assisted-by: Claude