-
Notifications
You must be signed in to change notification settings - Fork 6k
infosync: refactor server config into dynamic and static sections #58473
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 @you06. 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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #58473 +/- ##
================================================
+ Coverage 73.0774% 75.0679% +1.9904%
================================================
Files 1701 1753 +52
Lines 469836 489261 +19425
================================================
+ Hits 343344 367278 +23934
+ Misses 105319 99432 -5887
- Partials 21173 22551 +1378
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
/retest |
@you06: 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. |
// which will be changed on occasions such as connection to PD is restored after broken. | ||
ServerIDGetter func() uint64 `json:"-"` | ||
StaticServerInfo | ||
DynamicServerInfo |
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.
Seems DynamicServerInfo is also static because its value never changes for ServerInfo
?
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.
It's updated in setDynamicServerInfo
, which replaces InfoSyncer.info
with a new ServerInfo
.
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.
Do you think it's better to move StaticServerInfo
out of atomic.Pointer[ServerInfo]
? We can let info
become a struct { staticServerInfo, atomic.Pointer[dynamicServerInfo] }
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 current implementation provides a simpler interface for user, just call getLocalServerInfo
to get the entire ServerInfo
object.
pkg/domain/infosync/info.go
Outdated
ServerIDGetter: serverIDGetter, | ||
}, | ||
DynamicServerInfo: DynamicServerInfo{ | ||
Labels: labels, |
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.
seems to use maps.Clone
is more elegant here?
Signed-off-by: you06 <[email protected]> fix lint & update mem after etcd Signed-off-by: you06 <[email protected]> wait goroutine quit Signed-off-by: you06 <[email protected]> fix update label Signed-off-by: you06 <[email protected]> update func name Signed-off-by: you06 <[email protected]> remove import Signed-off-by: you06 <[email protected]> address comment Signed-off-by: you06 <[email protected]> add comments Signed-off-by: you06 <[email protected]> bazel Signed-off-by: you06 <[email protected]>
47bb12d
to
c50fa72
Compare
Signed-off-by: you06 <[email protected]>
/retest |
@you06: 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. |
@lance6716, @time-and-fate |
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.
LGTM
[LGTM Timeline notifier]Timeline:
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hawkingrei, lance6716, lcwangchao, YangKeao The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
@you06: 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. |
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
Signed-off-by: ti-chi-bot <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]> resolve conflict Signed-off-by: you06 <[email protected]>
Signed-off-by: ti-chi-bot <[email protected]> Revert "This is an automated cherry-pick of pingcap#58473" This reverts commit bf5fda5. resolve conflict Signed-off-by: you06 <[email protected]> fix build Signed-off-by: you06 <[email protected]>
Signed-off-by: ti-chi-bot <[email protected]> Revert "This is an automated cherry-pick of pingcap#58473" This reverts commit bf5fda5. resolve conflict Signed-off-by: you06 <[email protected]> fix build Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]> enabel race Signed-off-by: you06 <[email protected]> fix build Signed-off-by: you06 <[email protected]> fix build Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]>
Signed-off-by: you06 <[email protected]> enabel race Signed-off-by: you06 <[email protected]> fix build Signed-off-by: you06 <[email protected]> fix build Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> fix test Signed-off-by: you06 <[email protected]> debug Signed-off-by: you06 <[email protected]> ensure the test chan is init Signed-off-by: you06 <[email protected]> do not test with race mode Signed-off-by: you06 <[email protected]>
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <[email protected]>
What problem does this PR solve?
Issue Number: close #58405
Problem Summary:
The labels of TiDB are stored within a static structure, meanwhile TiDB have update-label API. Before this PR, the way TiDB handles the mutations of labels have data-race risk.
What changed and how does it work?
Refactor the
ServerInfo
into static and dynamic sections and fix the data race by atomic operations.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.