[#10683] fix(iceberg-rest-server): support Idempotency-Key header and replay for mutation endpoints#10751
Open
laserninja wants to merge 1 commit intoapache:mainfrom
Open
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.
What changes were proposed in this pull request?
Add support for the
Idempotency-KeyHTTP header on all mutation (POST/DELETE) endpoints in the Iceberg REST server. When a client sends a valid UUIDv7 idempotency key with a mutation request, the server caches the successful response and replays it on subsequent retries, preventing duplicate side-effects.Key implementation details:
IcebergIdempotencyManagerclass with:replayOrExecute()usingConcurrentHashMapkey locks with double-check pattern@HeaderParam("Idempotency-Key")to all mutation endpoints:createTable,updateTable,dropTablecreateNamespace,updateNamespace,dropNamespace,registerTablecreateView,replaceView,dropViewidempotency-key-lifetime(ISO-8601 duration) inGET /v1/configdefaultsidempotency-key-lifetime-minutes(default: 30)Why are the changes needed?
Fixes #10683
Network failures and client retries against the Iceberg REST catalog can cause duplicate table/namespace/view creation or deletion. The Iceberg REST spec recommends idempotency key support for mutation endpoints to safely handle retries.
Does this PR introduce any user-facing change?
Yes:
Idempotency-Key: <UUIDv7>header on mutation requests for safe retryGET /v1/configresponse now includesidempotency-key-lifetimein defaultsidempotency-key-lifetime-minutes(default 30)How was this patch tested?
TestIcebergTableOperations:testCreateTableWithIdempotencyKey,testCreateTableRejectsInvalidIdempotencyKeyTestIcebergNamespaceOperations:testRegisterTableWithIdempotencyKeyTestIcebergViewOperations:testCreateViewWithIdempotencyKeyTestIcebergConfigupdated to verifyidempotency-key-lifetimein config response