-
Notifications
You must be signed in to change notification settings - Fork 720
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
encryption: refine key manager watcher loop #4111
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
cc @yiwu-arbug |
m.helper.eventAfterTicker() | ||
} | ||
|
||
select { |
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.
when server being shutdown, will it stop the watcher loop?
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.
watcher.Watch
uses ctx
, when ctx
is Done
, it will break.
server/encryptionkm/key_manager.go
Outdated
for { | ||
select { | ||
case resp, ok = <-rch: | ||
if !ok || resp.CompactRevision != 0 || resp.Canceled { |
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.
what does compact revision != 0 mean? It has been a while I forget most about etcd.
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.
Compact_Revision - set to the minimum historical revision available to etcd if a watcher tries watching at a compacted revision. This happens when creating a watcher at a compacted revision or the watcher cannot catch up with the progress of the key-value store. The watcher will be canceled; creating new watches with the same start_revision will fail.
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.
can you add inline comment about it?
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.
done
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 think you can use !ok || resp.Err() != nil
directly.
@yiwu-arbug: Thanks for your review. The bot only counts approvals from reviewers and higher roles in list, but you're still welcome to leave your comments. 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 ti-community-infra/tichi 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.
rest lgtm
Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: HunDunDM <hundundm@gmail.com>
Signed-off-by: HunDunDM <hundundm@gmail.com>
5d7bb9a
to
ec196b1
Compare
/merge |
@nolouch: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests 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 ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: ec196b1
|
Codecov Report
@@ Coverage Diff @@
## master #4111 +/- ##
==========================================
+ Coverage 74.37% 74.43% +0.05%
==========================================
Files 260 260
Lines 26467 26476 +9
==========================================
+ Hits 19686 19707 +21
+ Misses 5000 4993 -7
+ Partials 1781 1776 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
In response to a cherrypick label: new pull request created: #4153. |
In response to a cherrypick label: new pull request created: #4154. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #4155. |
* remove watcherEnabled Signed-off-by: HunDunDM <hundundm@gmail.com> * encryption: refine key manager watcher loop Signed-off-by: HunDunDM <hundundm@gmail.com> * fix log Signed-off-by: HunDunDM <hundundm@gmail.com> * add comment Signed-off-by: HunDunDM <hundundm@gmail.com> * add comment Signed-off-by: HunDunDM <hundundm@gmail.com> * address comment Signed-off-by: HunDunDM <hundundm@gmail.com> * *: use SerialSuites to reduce the servers in tests at the same time (#4171) Signed-off-by: HunDunDM <hundundm@gmail.com> Co-authored-by: HunDunDM <hundundm@gmail.com>
* remove watcherEnabled Signed-off-by: HunDunDM <hundundm@gmail.com> * encryption: refine key manager watcher loop Signed-off-by: HunDunDM <hundundm@gmail.com> * fix log Signed-off-by: HunDunDM <hundundm@gmail.com> * add comment Signed-off-by: HunDunDM <hundundm@gmail.com> * add comment Signed-off-by: HunDunDM <hundundm@gmail.com> * address comment Signed-off-by: HunDunDM <hundundm@gmail.com> Signed-off-by: hzh0425 <642256541@qq.com>
What problem does this PR solve?
Fix #4071
What is changed and how it works?
encryption: refine key manager watcher loop
Check List
Tests
Code changes
Side effects
Related changes
Release note