performance: Decouple segment construction from OfflineWriter.Batch locking#149
Open
shoriwe wants to merge 9 commits intoblugelabs:masterfrom
Open
performance: Decouple segment construction from OfflineWriter.Batch locking#149shoriwe wants to merge 9 commits intoblugelabs:masterfrom
shoriwe wants to merge 9 commits intoblugelabs:masterfrom
Conversation
shoriwe
commented
Mar 16, 2026
Comment on lines
-60
to
-62
| s.m.Lock() | ||
| defer s.m.Unlock() | ||
|
|
Author
There was a problem hiding this comment.
With this change caller can go directly to Analyze, segment and persist the changes as soon as possible. Instead of waiting for the entire function to finish
shoriwe
commented
Mar 16, 2026
Comment on lines
+83
to
+85
| s.m.Lock() | ||
| s.segIDs = append(s.segIDs, newId) | ||
| s.m.Unlock() |
Author
There was a problem hiding this comment.
This is the only thread unsafe part of the code, since slices can't be appended concurrently
shoriwe
commented
Mar 16, 2026
Comment on lines
+76
to
+78
| newId := s.segCount.Add(1) | ||
| // There is zero chance of collision we can safely use the computed id | ||
| err = s.directory.Persist(ItemKindSegment, newId, newSegment, nil) |
Author
There was a problem hiding this comment.
Once the new segment id is computed, the persist function should respect any subsequent segment
Author
|
Added some description to the why of the changes. Looking forward for a review |
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.
Reference issue
#148