-
Notifications
You must be signed in to change notification settings - Fork 726
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
*: [wip]Apply the configuration changes immediately in the followers #1467
Conversation
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
1 similar comment
Hi contributor, thanks for your PR. This patch needs to be approved by someone of admins. They should reply with "/ok-to-test" to accept this PR for running test automatically. |
/rebuild |
server/leader.go
Outdated
@@ -292,6 +292,21 @@ func (s *Server) campaignLeader() error { | |||
log.Info("server is closed") | |||
return nil | |||
} | |||
|
|||
// leader apply config | |||
configHash, err := s.kv.LoadConfigHash() |
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.
Leader no need to reload, it will be set firstly then persist to KV.
server/leader.go
Outdated
@@ -318,6 +333,21 @@ func (s *Server) watchLeader(leader *pdpb.Member, revision int64) { | |||
// If the revision is compacted, will meet required revision has been compacted error. | |||
// In this case, use the compact revision to re-watch the key. | |||
for { | |||
//follower watch config change and apply it | |||
configHash, err := s.kv.LoadConfigHash() |
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.
This logic will not be executed periodically or immediately. the rch
will block until the leader changed or some error meet.
@bradyjoestar Plase signs the |
@nolouch I will do it tonight and try to find why ci isn't passed. 🍺 |
/rebuild |
@bradyjoestar For the CI problem, I have raised a PR to make it more stable. See #1471. |
@rleungx got 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.
We need a test to verify it.
break | ||
} | ||
} | ||
time.Sleep(200 * time.Millisecond) |
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 it is too frequent to read from KV
, maybe we can use Watch
API like the leader key to listen key changed.
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.
👌
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.
Hi @bradyjoestar, after we discussed, there is a better solution. Because we not only PD need to dynamically load the configuration, but also TiKV needs. we can add a service in gRPC
that provides the Watch
function. If you are interested, you can send your wechat
to my email. chenshuning@pingcap.com
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.
@nolunch Have send to your email. It sounds cool 😸
Codecov Report
@@ Coverage Diff @@
## master #1467 +/- ##
=========================================
Coverage ? 67.43%
=========================================
Files ? 158
Lines ? 15364
Branches ? 0
=========================================
Hits ? 10361
Misses ? 4062
Partials ? 941
Continue to review full report at Codecov.
|
I am recently focuing on libos in the intel-sgx, so sorry for delaying this pr. Sorry! |
What problem does this PR solve?
#1466 issue-1466
What is changed and how it works?
wait for watch service.