-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve checkpoint series iterator. #3193
Conversation
Signed-off-by: Cyril Tovena <[email protected]>
Signed-off-by: Cyril Tovena <[email protected]>
Signed-off-by: Cyril Tovena <[email protected]>
Signed-off-by: Cyril Tovena <[email protected]>
Signed-off-by: Cyril Tovena <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #3193 +/- ##
==========================================
- Coverage 63.33% 63.23% -0.10%
==========================================
Files 191 191
Lines 16455 16514 +59
==========================================
+ Hits 10421 10442 +21
- Misses 5089 5128 +39
+ Partials 945 944 -1
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit, then LGTM.
Great work
// it's possible the stream has been flushed to storage | ||
// in between starting the checkpointing process and | ||
// checkpointing this stream. | ||
return s.Next() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't think of a deadlock scenario while holding the chunk mutex here and calling s.Next()
, but I am worried about it.
defer stream.chunkMtx.RUnlock() | ||
|
||
if len(stream.chunks) < 1 { | ||
// it's possible the stream has been flushed to storage | ||
// in between starting the checkpointing process and | ||
// checkpointing this stream. | ||
return s.Next() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defer stream.chunkMtx.RUnlock() | |
if len(stream.chunks) < 1 { | |
// it's possible the stream has been flushed to storage | |
// in between starting the checkpointing process and | |
// checkpointing this stream. | |
return s.Next() | |
} | |
if len(stream.chunks) < 1 { | |
// it's possible the stream has been flushed to storage | |
// in between starting the checkpointing process and | |
// checkpointing this stream. | |
stream.chunkMtx.RUnlock() | |
return s.Next() | |
} | |
defer stream.chunkMtx.RUnlock() |
Signed-off-by: Cyril Tovena <[email protected]>
This is a big refactoring allowing to use less memory when iterating over series for checkpointing purpose.