-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat: WIP defer'ing compaction decrement #26273
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
base: master-1.x
Are you sure you want to change the base?
Conversation
p.levelCompacting[0] = false | ||
p.mu.Unlock() | ||
p.Compact() | ||
defer func() { |
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.
The defer
should go at the top of the lambda, otherwise this change won't actually make any difference. Even then, it would only make a difference if p.compactLogFile
panics.
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.
👍
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
has to be called earlier to ensure execution on error.
p.levelCompacting[0] = false | ||
p.mu.Unlock() | ||
p.Compact() | ||
defer func() { |
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.
The defer
has to be called before the p.compactLogFile
|
||
// Check for new compactions | ||
p.Compact() | ||
defer func() { |
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.
the defer
has to be called before the p.compactToLevel
Overall, I'm not sure the What's the scenario where |
p.currentCompactionN-- | ||
p.levelCompacting[0] = false | ||
p.mu.Unlock() | ||
p.Compact() |
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.
The p.Compact
call here leads to indirect tail-call recursion. Putting the call in a defer will add another level to the stack. Depending on how deep the recursion goes, adding this extra stack frame every time may cause problems. Do we think p.compactLogFile
panics?
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.
More specifically, do we think p.compactLogFile
panics, and then that is recovered higher up in the stack? Otherwise, I don't see this change making any difference.
No description provided.