Skip to content

Commit

Permalink
double check current member's leadership before perform lease renew r…
Browse files Browse the repository at this point in the history
…equest

Signed-off-by: Benjamin Wang <[email protected]>
  • Loading branch information
ahrtr committed Oct 30, 2023
1 parent c6ac191 commit ebedb90
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/etcdserver/v3_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,9 @@ func (s *EtcdServer) LeaseRevoke(ctx context.Context, r *pb.LeaseRevokeRequest)

func (s *EtcdServer) LeaseRenew(ctx context.Context, id lease.LeaseID) (int64, error) {
if s.isLeader() {
if !s.ensureLeadership() {
return -1, lease.ErrNotPrimary
}
if err := s.waitAppliedIndex(); err != nil {
return 0, err
}
Expand Down

0 comments on commit ebedb90

Please sign in to comment.