-
Notifications
You must be signed in to change notification settings - Fork 6k
*: make domain Reload() thread safe #58722
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
Conversation
Hi @tiancaiamao. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #58722 +/- ##
================================================
+ Coverage 73.0858% 74.9855% +1.8997%
================================================
Files 1676 1723 +47
Lines 463685 478976 +15291
================================================
+ Hits 338888 359163 +20275
+ Misses 103941 97153 -6788
- Partials 20856 22660 +1804
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
@tiancaiamao: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
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.
we have a lock here, how it enter twice?
Lines 768 to 777 in 7063a6f
func (do *Domain) Reload() error { | |
failpoint.Inject("ErrorMockReloadFailed", func(val failpoint.Value) { | |
if val.(bool) { | |
failpoint.Return(errors.New("mock reload failed")) | |
} | |
}) | |
// Lock here for only once at the same time. | |
do.m.Lock() | |
defer do.m.Unlock() |
func (ch schemaLoader) Reload() error { | ||
var msg schemaReloadMsg | ||
msg.wg.Add(1) | ||
ch <- &msg |
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.
to avoid dead waiting, also select from domain's exit channel
Also I'm not sure about the up-to-date guarantee of Reload. can we use singleflight to merge concurrent invocation?
Use #58815 instead. |
What problem does this PR solve?
Issue Number: close #58712
Problem Summary:
What changed and how does it work?
InfoSchema is a global instance,
domain.Reload()
will reload the schema and update it.This should be a thread-safe operation.
After #58466, we assume the visit pattern is one writes multiple readers.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.