Commit shards incrementally within a month#9
Merged
Conversation
Publish uploaded a month's shards in one hub commit after the whole file was processed. A big month runs for hours, so the first commit and any proof the pipeline works were hours away, and a restart redid the entire month from shard zero. Stream the shards to the hub in batches of --commit-every (default 8) as they are written. Each batch records how far the month has progressed in publish-progress.json and drops the uploaded shards locally, so disk stays low on the large comments months. A restart reads the marker and resumes after the committed shards instead of reprocessing them; the marker is engine-tagged since the go and duckdb engines draw shard boundaries differently. The ledger row and README still land once, at month end. ProcessFileStream carries the StartShard and per-shard callback for both engines; ProcessFile and ProcessFileTo stay as thin wrappers.
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
Publish uploaded a whole month's shards in one hub commit after the entire
.zstfinished processing. A big month (2021-05 submissions is ~64 shards, comments months run to hundreds) takes hours, so:What
Stream shards to the hub in batches of
--commit-every(default 8,ARCTIC_COMMIT_EVERY) as they are written:ProcessFileStreamadds aStartShardand a per-shard callback to both the go and duckdb engines;ProcessFile/ProcessFileTostay as thin wrappers.publish-progress.jsonrecords how far the month got (shards, records, bytes) and the uploaded shards are removed locally, keeping disk low on the comments months.--commit-every 0keeps the old behavior (one commit at month end).Tests
ProcessFileStreamresume skips already-committed shards, emits only the rest, and the resumed shard holds the same rows.Default
go build/vet/testand-racepass;-tags duckdbbuilds clean. (The pre-existingTestProcessFileCommentsfailure under-tags duckdbis unrelated — it asserts go-engine skip counts while running the duckdb engine, and fails the same way onmain.)