Skip to content

Commit

Permalink
support linearizable renew lease
Browse files Browse the repository at this point in the history
  • Loading branch information
ahrtr committed Feb 12, 2022
1 parent bba3937 commit a5ba619
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/etcdserver/v3_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ 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 err := s.LinearizableReadNotify(ctx); err != nil {
return 0, err
}
}

ttl, err := s.lessor.Renew(id)
if err == nil { // already requested to primary lessor(leader)
return ttl, nil
Expand Down

0 comments on commit a5ba619

Please sign in to comment.