-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix a locking issue in the Rollback manager #6426
Conversation
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.
Overall LGTM. One minor minor adjustment.
9b7fdf3
return rsInflight | ||
} | ||
|
||
cancelCtx, cancelFunc := context.WithCancel(context.Background()) |
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.
Should this not derive the context using the ctx
param and not context.Background()
?
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 don't think it's necessary, doesn't need to be tied to any other external states
// If we stopped due to shutdown, return. Otherwise another thread | ||
// is holding the lock for us, continue on. | ||
select { | ||
case <-m.shutdownCh: |
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.
Will it be possible to read from this channel both in here and in the goroutine above?
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.
In the above goroutine, in case of a shutdown, stopCh will be closed by reading m.shutdownCh
. We are trying to read from the same again here.
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.
You can read from a closed channel multiple times
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.
Remember that a receive from a closed channel returns immediately. So that's okay, we're not trying to consume anything, just use it as a signal.
@briankassouf This is already merged but I had 2 minor comments. Otherwise it looked good. |
No description provided.