Parallelize InMemoryIndex construction with bucket put loop.#5288
Open
dmkozh wants to merge 1 commit into
Open
Parallelize InMemoryIndex construction with bucket put loop.#5288dmkozh wants to merge 1 commit into
dmkozh wants to merge 1 commit into
Conversation
Build the LiveBucketIndex on an async worker thread while the put loop in mergeInMemory runs on the main thread. Both only read mergedEntries as const, so they need no synchronization.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR parallelizes level-0 LiveBucket::mergeInMemory work by constructing the LiveBucketIndex on a worker thread while the main thread writes merged entries to the bucket file, then passes the pre-built index into BucketOutputIterator::getBucket() to avoid rebuilding it.
Changes:
- Spawn
LiveBucketIndexconstruction viastd::asyncduringLiveBucket::mergeInMemorywhile the merge output is written to disk. - Extend
BucketOutputIterator::getBucket()to accept an optional pre-built index (preBuiltIndex) and prefer it when provided. - Wire the pre-built index from
mergeInMemoryintogetBucket().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/bucket/LiveBucket.cpp | Starts async index construction during in-memory merge and forwards the built index into bucket adoption. |
| src/bucket/BucketOutputIterator.h | Adds an optional preBuiltIndex parameter to getBucket() with a default nullptr. |
| src/bucket/BucketOutputIterator.cpp | Uses preBuiltIndex when provided to avoid recomputing an index from in-memory state or disk. |
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.
Description
Build the LiveBucketIndex on an async worker thread while the put loop in mergeInMemory runs on the main thread. Both only read mergedEntries as const, so they need no synchronization.
Checklist
clang-formatv8.0.0 (viamake formator the Visual Studio extension)