Skip to content

Commit

Permalink
ignore old leader's leases revoking request
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Wang <wachao@vmware.com>
  • Loading branch information
ahrtr committed Oct 24, 2023
1 parent 3347568 commit 25203e6
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions server/etcdserver/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -858,8 +858,20 @@ func (s *EtcdServer) run() {
}

func (s *EtcdServer) revokeExpiredLeases(leases []*lease.Lease) {
lg := s.Logger()
newLeaderId := s.raftStatus().Lead
// This can only mitigate the issue. This can't completely resolve
// https://github.com/etcd-io/etcd/issues/15247. Because the leases
// may be wrongly revoked by the new leader. Refer to the document in
// https://github.com/etcd-io/etcd/issues/15247#issuecomment-1777862093.
if newLeaderId != uint64(s.MemberId()) {
lg.Warn("Ignore old leader's leases revoking requests",
zap.Uint64("local-member-id", uint64(s.MemberId())),
zap.Uint64("new-lead", newLeaderId))
return
}

s.GoAttach(func() {
lg := s.Logger()
// Increases throughput of expired leases deletion process through parallelization
c := make(chan struct{}, maxPendingRevokes)
for _, curLease := range leases {
Expand All @@ -868,7 +880,6 @@ func (s *EtcdServer) revokeExpiredLeases(leases []*lease.Lease) {
case <-s.stopping:
return
}

f := func(lid int64) {
s.GoAttach(func() {
ctx := s.authStore.WithRoot(s.ctx)
Expand Down

0 comments on commit 25203e6

Please sign in to comment.