db/seg: collapse compression workers=1 case into batched workers flow - #23058
Open
sudeepdino008 wants to merge 2 commits into
Open
db/seg: collapse compression workers=1 case into batched workers flow#23058sudeepdino008 wants to merge 2 commits into
sudeepdino008 wants to merge 2 commits into
Conversation
sudeepdino008
marked this pull request as ready for review
August 7, 2026 04:52
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors db/seg compression so the Workers=1 cover/compression path uses the same batched-worker pipeline as the Workers>1 path, removing the prior special-cased single-worker implementation. This simplifies the code while accepting a small Workers=1 performance regression, and updates tests to pin byte-identical output to pre-batching checksums across worker counts.
Changes:
- Remove the special-case single-worker cover/compression path and always run through the batched worker pipeline.
- Adjust cover batching sizing logic to apply uniformly, and unify queue/drain logic for all worker counts.
- Update parallel compression tests to validate round-trip correctness and stable on-disk encoding via fixed CRC32 checksums across worker counts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| db/seg/parallel_compress.go | Collapses Workers=1 and Workers>1 compression flows into a single batched worker pipeline. |
| db/seg/compress_parallel_test.go | Updates helpers/tests to assert stable output encoding via fixed checksums across worker counts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collapse the Workers==1 special case into the batched worker pipeline so there is a single code path. Pure refactor, no behavior change: the golden checksums pin every worker count (including 1) to the original on-disk encoding. W=1 costs ~2.6% on the cover phase (two extra CompressionWord copies plus the queue push/pop) and under 1% end-to-end, since dictionary learning dominates a real merge.
sudeepdino008
force-pushed
the
sudeep/seg-cover-single-path
branch
from
August 7, 2026 09:24
40c9fb1 to
baae28a
Compare
sudeepdino008
enabled auto-merge
August 8, 2026 13:59
AskAlexSharov
approved these changes
Aug 9, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 9, 2026
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.
Summary
Benchmark
Re-compressing the word stream of a real mainnet storage
.kv(527 MB, 17.6M words / 8.8M keys, key compressed + value not, asCompressKeysdoes), 2 iterations x 2 rounds:Workers > 1is unchanged code, so those rows measure the noise floor (±1.5%).A synthetic corpus (1M sorted 52-byte storage-like keys) resolves the
Workers=1cost more tightly — 10 iterations x 3 alternating rounds, medians varying under 1 ms within each version:So ~2.6% on the cover phase at
Workers=1, under 1% end-to-end — the two extraCompressionWordcopies plus the queue push/pop. Dictionary learning dominates a real merge, which is why the end-to-end cost stays inside the noise.Notes