-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
pickerwrapper: use atomic instead of locks #7214
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.
Looks great!!
blockingCh chan struct{} | ||
picker balancer.Picker | ||
// If pickerGen holds a nil pointer, the pickerWrapper is closed. | ||
pickerGen atomic.Pointer[pickerGeneration] |
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.
Wohooo, generics!!
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 like atomic.Pointer
a lot. atomic
's unsafe.Pointer
operations were terrible.
picker_wrapper.go
Outdated
pw.pickerGen.Store(&pickerGeneration{ | ||
blockingCh: make(chan struct{}), | ||
}) | ||
return pw | ||
} | ||
|
||
// updatePicker is called by UpdateBalancerState. It unblocks all blocked pick. |
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.
While you are here, could you please update this comment to say UpdateState
instead of UpdateBalancerState
. Thanks.
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.
Clarified that it comes from the LB policy since we have 16 different UpdateState
s.
RELEASE NOTES: none