-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
etcdserver: resend ReadIndex request on empty apply request #12795
etcdserver: resend ReadIndex request on empty apply request #12795
Conversation
c168f5c
to
06a627a
Compare
06a627a
to
1d96146
Compare
server/etcdserver/server.go
Outdated
@@ -2067,6 +2081,8 @@ func (s *EtcdServer) applyEntryNormal(e *raftpb.Entry) { | |||
// raft state machine may generate noop entry when leader confirmation. | |||
// skip it in advance to avoid some potential bug in the future | |||
if len(e.Data) == 0 { | |||
s.notifyAboutFirstCommitInTerm() | |||
|
|||
select { | |||
case s.forceVersionC <- struct{}{}: |
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.
Please add at least a TODO to replace forceVersionC with FirstCommitInTermNotify as they do exactly the same thing.
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.
FTR:
Please add an integration test whether the notification really happens during leadership change.
1d96146
to
58ceed4
Compare
Test I've added was flaky once I've set cluster size to 21. It was failing with |
Empty apply indicates first commit in current term. It is first time when follower is sure, that it's ReadIndex request can be processed.
58ceed4
to
943bcc3
Compare
|
||
err = group.Wait() | ||
if err != nil { | ||
t.Errorf("korona %v", err) |
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.
whoops :D
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.
Thank you.
LGTM to me. Just a single comment to fix.
943bcc3
to
08ea9cb
Compare
Backport etcd-io#12795 to 3.4 Signed-off-by: Benjamin Wang <wachao@vmware.com>
Backport etcd-io#12795 to 3.4 Signed-off-by: Benjamin Wang <wachao@vmware.com>
Empty apply indicates first commit in current term. It is first time when follower is sure, that its ReadIndex request can be processed.
Idea for this PR was born in discussion under #12762 (comment).