Repository navigation
Core: Write rewrite manifests concurrently but commit one at a time - #17986
Draft
smaheshwar-pltr wants to merge 8 commits into
Draft
smaheshwar-pltr wants to merge 8 commits into
smaheshwar-pltr wants to merge 8 commits into
Conversation
Give one offering thread non-blocking drain ownership so ready groups never commit concurrently and competing offers do not wait. Reject non-positive batch sizes so the drain condition always makes progress. Generated-by: OpenAI Codex
Apply the zero-failure assertions from Spark 4.1 to the identical 3.5, 4.0, and 4.2 tests. Also remove an unused TrackingCommitService constructor from the core test.
1 of 3 tasks
Give the blocking file-group fixture a constant string representation so debug logging does not release the extraction latch before enqueueing. Generated-by: OpenAI Codex
|
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions. |
Contributor
Author
|
Not stale |
Concurrent partial-progress commits to the same table conflict, retry with backoff, and can drop rewritten groups when retries run out. Commit under a lock in the rewrite commit managers, applying each rewrite first so manifest writing stays concurrent and only the metadata update is serialized. This replaces the BaseCommitService lock, which serialized manifest writing as well. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Log a failed early apply at debug level since commit() reports any failure that persists. Check Parquet manifests on v4 tables and that concurrent commits leave no unreferenced metadata files. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
If writing new delete manifests failed, applying again counted the added delete files twice in the snapshot summary. The early apply in the rewrite commit managers makes this retry reachable. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add commit manager tests for position deletes, describe what commit() reuses from the early apply, and drop a data-file test that the concurrent test already covers. Generated-by: Claude Code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Why
With
partial-progress.enabled, each rewrite worker commits its own batch, so up tomax-concurrent-file-group-rewritescommits to the same table run at once. One wins each round. The rest back off and retry, writing a new manifest list each time and re-filtering any input manifest that another commit replaced. A batch that runs out ofcommit.retry.num-retriesis cleaned up and its rewrite is lost. With the default 4 retries this happens even without other writers: in benchmark runs with 4 to 16 workers,mainlost groups in 54 of 75.Change
The rewrite commit managers call
apply()before taking a lock andcommit()inside it.apply()runs concurrently and the producer caches the manifests it writes. Under the lock,commit()refreshes, validates, writes the manifest list and swaps metadata, and only re-filters or re-merges manifests that another commit changed in the meantime. A failedapply()is logged andcommit()applies again, so failures and cleanup behave as before.Applying again after a failed delete manifest write counted the added delete files twice in the snapshot summary, so
MergingSnapshotProducernow rebuilds that summary with the manifests.Locking the whole
commit()would be simpler, but it serializes manifest writing too. The "whole-commit lock" column below shows the cost, measured with a variant that commits ready batches one at a time while the other workers keep rewriting.Benchmark
Spark 4.1
local[16], HadoopCatalog, one group per commit, median of 5 runs in seconds. Groups are 4 small files that rewrite in about 70 ms, so runs are commit-bound. Delays simulate object-store latency on writes; reads are not delayed.mainWith this change no commit retried and no groups were lost. In the first row
mainalso lost 2.8 of 32 groups per run. With one worker nothing overlaps the earlyapply(), so its extra refresh, validation and manifest list write show up: about 50 ms per commit, or 150 ms when manifest list writes are slow. Rewrites without partial progress and Flink's rewrite committer pay this once per commit.manifests-replacedin the snapshot summary and commit report can over-count when a manifest that the earlyapply()filtered or merged is replaced beforecommit(). Retries onmainalready do this; I'll fix the count separately.Testing
TestRewriteDataFilesCommitManagerandTestRewritePositionDeletesCommitManagercommit 8 groups concurrently withcommit.retry.num-retries=0, which fails onmainwithCommitFailedException, and check that concurrent and failed commits leave no unreferenced metadata files. A newTestRowDeltacase covers the summary fix. The Spark partial-progress test no longer tolerates a failed commit.AI Disclosure
🤖 Generated with Claude Code