Skip to content

[KYUUBI #7720][SERVER] Reconcile duplicate-key insert retries - #7721

Open
nnvscholar-collab wants to merge 1 commit into
apache:masterfrom
nnvscholar-collab:kyuubi-7720-insert-retry-duplicate-key
Open

[KYUUBI #7720][SERVER] Reconcile duplicate-key insert retries#7721
nnvscholar-collab wants to merge 1 commit into
apache:masterfrom
nnvscholar-collab:kyuubi-7720-insert-retry-duplicate-key

Conversation

@nnvscholar-collab

Copy link
Copy Markdown

Why are the changes needed?

When a queued InsertMetadata retry 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. insertMetadata intentionally fails fast on duplicate-key errors, and since the retry loop only caught exceptions around the whole while block, 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Queued InsertMetadata retry can block metadata retry queue forever on duplicate-key error

1 participant