-
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: return membership.ErrIDNotFound
when the memberID not found
#15095
Conversation
Backport etcd-io#15095. When promoting a learner, we need to wait until the leader's applied ID catches up to the commitId. Afterwards, check whether the learner ID exist or not, and return `membership.ErrIDNotFound` directly in the API if the member ID not found, to avoid the request being unnecessarily delivered to raft. Signed-off-by: Benjamin Wang <[email protected]>
Backport etcd-io#15095 to 3.4. When promoting a learner, we need to wait until the leader's applied ID catches up to the commitId. Afterwards, check whether the learner ID exist or not, and return `membership.ErrIDNotFound` directly in the API if the member ID not found, to avoid the request being unnecessarily delivered to raft. Signed-off-by: Benjamin Wang <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #15095 +/- ##
==========================================
- Coverage 74.72% 74.61% -0.12%
==========================================
Files 415 415
Lines 34340 34343 +3
==========================================
- Hits 25661 25624 -37
- Misses 7045 7077 +32
- Partials 1634 1642 +8
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. 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.
Thank you. The logic seems better than it used to.
Still I'm not confident the code will work well if e.g. during waitAppliedIndex the leader changes]... It's likely rs.Progress will report NULL in such a situation.
Shell we fetch
waitAppliedIndex(...)
progress:=rs.Progress
if (progress == nil) ...
...
fir memberId, progress := range progress { ...
When promoting a learner, we need to wait until the leader's applied ID catches up to the commitId. Afterwards, check whether the learner ID exist or not, and return `membership.ErrIDNotFound` directly in the API if the member ID not found, to avoid the request being unnecessarily delivered to raft. Signed-off-by: Benjamin Wang <[email protected]>
2398d57
to
8ed20e8
Compare
It seems not a problem. Even the leader changes during But actually it doesn't make sense to execute |
Backport etcd-io#15095. When promoting a learner, we need to wait until the leader's applied ID catches up to the commitId. Afterwards, check whether the learner ID exist or not, and return `membership.ErrIDNotFound` directly in the API if the member ID not found, to avoid the request being unnecessarily delivered to raft. Signed-off-by: Benjamin Wang <[email protected]>
Backport etcd-io#15095 to 3.4. When promoting a learner, we need to wait until the leader's applied ID catches up to the commitId. Afterwards, check whether the learner ID exist or not, and return `membership.ErrIDNotFound` directly in the API if the member ID not found, to avoid the request being unnecessarily delivered to raft. Signed-off-by: Benjamin Wang <[email protected]>
thx @ptabor for the quick review. |
Backport etcd-io#15095. When promoting a learner, we need to wait until the leader's applied ID catches up to the commitId. Afterwards, check whether the learner ID exist or not, and return `membership.ErrIDNotFound` directly in the API if the member ID not found, to avoid the request being unnecessarily delivered to raft. Signed-off-by: Benjamin Wang <[email protected]>
Backport etcd-io#15095. When promoting a learner, we need to wait until the leader's applied ID catches up to the commitId. Afterwards, check whether the learner ID exist or not, and return `membership.ErrIDNotFound` directly in the API if the member ID not found, to avoid the request being unnecessarily delivered to raft. Signed-off-by: Benjamin Wang <[email protected]>
This PR should fix the failure in https://github.com/etcd-io/etcd/actions/runs/3908224614/jobs/6678181444
The existing test cases
TestMemberPromote*
in cluster_test.go already covers the code path updated in this PR.Signed-off-by: Benjamin Wang [email protected]
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.