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 <[email protected]>
  • Loading branch information
ahrtr committed Oct 24, 2023
1 parent 3347568 commit 182c9d6
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion 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 Down

0 comments on commit 182c9d6

Please sign in to comment.