{{ message }}
Fix Iceberg REST catalog commit safety under post-commit network failure#2003
Open
il9ue wants to merge 3 commits into
Open
Fix Iceberg REST catalog commit safety under post-commit network failure#2003il9ue wants to merge 3 commits into
il9ue wants to merge 3 commits into
Conversation
On INSERT via a REST catalog, a commit whose response is lost was retried, got a 409, collapsed to a bool false, and triggered cleanup that deleted the files the now-live snapshot referenced. Replace the bool with a typed CommitOutcome and, on failure, re-read the catalog to classify whether our snapshot actually landed before deciding to clean up.
Follow-ups on the commit-safety fix. Treat CommitOutcome::Unknown as a hard stop rather than a retryable false: a lost-response commit may have already landed, so re-entering the transaction retry loop would double-apply the write. Abort with DATALAKE_DATABASE_ERROR (matching the retry-exhaustion convention) and preserve written files, guarding the mutation cleanup path so the abort never deletes a possibly-committed snapshot's data. Also catch Poco::TimeoutException on the commit POST so a timed-out response is classified through the same re-read path instead of leaking. Adds an integration test that drives the Unknown path and asserts the write aborts without double-applying and without deleting files.
27 tasks
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.

Found while working on #1609 (TRUNCATE storage-leak cleanup).
Changelog category (leave one):
Changelog entry:
Fix possible data loss in Iceberg writes via REST catalog when a commit response is lost
Documentation entry for user-facing changes
When the network drops the response to a catalog commit that actually succeeded, ClickHouse retries the commit, sees the retry fail, and runs cleanup that deletes object-storage files the catalog still references, that might lead to possible table corruption. The fix cleans up only when the commit was cleanly rejected; ambiguous outcomes leave the files in place and abort instead of retrying.
CI/CD Options
Exclude tests:
Regression jobs to run: