Repository navigation
fix(commit): answer a snapshot built on outdated table metadata with 409 - #2218
Conversation
A snapshot whose sequence number or first-row-id another commit has already used, for example a commit to another branch or a staged (WAP) snapshot racing a writer, now answers 409 CommitFailedException. The client reloads the table and retries. Before, the commit answered 400 InvalidTableUpdate and the job failed. This matches Iceberg Java's reference server since 1.11. Every other refused update keeps 400, and build errors keep 409.
… retryable conflicts)
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Commit update error mapping Cargo.toml, crates/lakekeeper/src/server/commit_tables.rs |
The workspace Iceberg revision changes. apply_commit maps retryable builder update errors to 409 CommitFailedException and non-retryable errors to 400 InvalidTableUpdate. |
Commit conflict tests crates/lakekeeper/src/server/commit_tables.rs, crates/lakekeeper-integration-tests/tests/server_tables_postgres.rs |
Tests check conflicts for stale sequence numbers and v3 first-row IDs, invalid updates for resent snapshots, and successful retries with updated values. The integration tests also check the conflict response and sequence number after retry. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Suggested reviewers: jankaul
Merge Risk: 
Minimal · up to 29699
-
Stale snapshot conflicts are set to return a retryable response, while refused updates retain their existing response. No issue requiring a change before merge was identified.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title names the main change: stale-snapshot commits now return 409 CommitFailedException instead of 400. The changeset matches this. The Cargo.toml bump, the integration tests, and commit_tables.rs all implement the 409 response for snapshots built on outdated metadata. The title uses the conventional commit form and stays within one line. It does not list files or use vague terms.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)
-
Finishing Touches
-
Generate docstrings
-
- Commit to this branch
- Create a new PR
Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the snapshot trail,
Stale numbers meet a conflict tale.
Fresh values pass the retry gate,
The current snapshot updates straight.
Then hops away, content and bright.
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
A commit whose snapshot uses a sequence number or first row ID that another commit has already used now answers
409 CommitFailedExceptioninstead of400. This happens when writers commit to different branches of one table, or when a staged (WAP) write and another commit to the same table run at the same time. Spark, Flink, Kafka Connect, PyIceberg 0.12 and iceberg-rust then reload the table and retry; before, the write failed.This is the behaviour of Iceberg Java's reference server since 1.11 (apache/iceberg#15126) and of Polaris. The iceberg-rust fork marks exactly these two builder errors as retryable conflicts (lakekeeper/iceberg-rust#17), and Lakekeeper answers a retryable builder error with 409.
Unchanged: a resend of a snapshot that already landed answers 400; every other refused update answers 400; errors from building the new metadata keep 409.
Release notes
409error, which it retries. Before, it got a400error and the write failed. This matches Iceberg Java 1.11.Downstream follow-up
Lakekeeper Plus pins
icebergdirectly and must move to the same iceberg-rust rev in the same step. A manifest rewrite planned on a format v1 table that was upgraded to v2 before the commit now gets a retryable conflict, re-plans on v2 and commits in the same run, as with Java 1.11; the Plus test that expects the run to fail must change at that bump.Summary by CodeRabbit