Fix concurrent table commits failing with a fatal 400 instead of a retryable 409#5138
Open
ayushtkn wants to merge 1 commit into
Open
Fix concurrent table commits failing with a fatal 400 instead of a retryable 409#5138ayushtkn wants to merge 1 commit into
ayushtkn wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Polaris’ Iceberg REST commit handling so concurrency-triggered RetryableValidationException is surfaced as a retryable conflict (HTTP 409 via CommitFailedException) rather than a fatal validation error (HTTP 400 via ValidationException), aligning behavior with Iceberg’s catalog handler semantics.
Changes:
- Catch
RetryableValidationExceptionwhile applyingMetadataUpdates and rethrow asCommitFailedExceptionin the single-table commit path (CatalogHandlerUtils.commit). - Add equivalent handling in the multi-table
commitTransactionpath (IcebergCatalogHandler.commitTransaction). - Add targeted tests asserting retryable validation failures do not leak as
ValidationException.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/CatalogHandlerUtils.java | Wraps RetryableValidationException from update application to avoid mapping to HTTP 400. |
| runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java | Adds RetryableValidationException handling in commitTransaction update application loop. |
| runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractLocalIcebergCatalogTest.java | Adds unit-style test ensuring CatalogHandlerUtils.commit surfaces retryable validation as CommitFailedException. |
| runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/CommitTransactionTest.java | Adds REST-level test ensuring commitTransaction surfaces retryable validation as CommitFailedException. |
Comment on lines
+521
to
+523
| throw new ValidationFailureException( | ||
| new CommitFailedException( | ||
| e, "Validation failed, please retry: %s", e.getMessage())); |
Member
Author
There was a problem hiding this comment.
I added a comment above but this suggestion is wrong, Server-side retry won’t help because the stale sequence number is in the request payload itself; the client must refresh metadata and retry. This matches upstream Iceberg CatalogHandlers.commit()
Comment on lines
+1537
to
+1541
| } catch (RetryableValidationException e) { | ||
| // Surface as a retryable 409, matching CatalogHandlerUtils.commit. | ||
| throw new CommitFailedException( | ||
| e, "Validation failed, please retry: %s", e.getMessage()); | ||
| } |
ayushtkn
force-pushed
the
rety
branch
4 times, most recently
from
July 24, 2026 22:36
596ebee to
721e61f
Compare
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.
Polaris'
CatalogHandlerUtilsreplicates Iceberg'sCatalogHandlers(as of 1.8.0) and never picked up theRetryableValidationExceptionhandlingCatalogHandlers.commit()added later. Under concurrency (e.g. writes to different branches of a table, or staged/WAP snapshots),TableMetadata.Builder.addSnapshotthrowsRetryableValidationException— aValidationExceptionsubclass — which Polaris leaks as a fatal HTTP400instead of the retryable409the Iceberg client would retry, permanently failing a commit that should succeed on rebase. This mirrorsCatalogHandlers.commit(), wrapping the update-apply step to rethrow aCommitFailedException, in both the single-table commit and multi-table commitTransaction pathsChecklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)