diff --git a/pkg/server/status.go b/pkg/server/status.go index 1a2333048ca3..138194b1b5b0 100644 --- a/pkg/server/status.go +++ b/pkg/server/status.go @@ -666,10 +666,17 @@ func (s *statusServer) Details( return nil, grpcstatus.Error(codes.Unavailable, "node is not ready") } - isHealthy, err := s.nodeLiveness.IsHealthy(nodeID) + clock := s.admin.server.clock + l, err := s.nodeLiveness.GetLiveness(nodeID) if err != nil { return nil, grpcstatus.Error(codes.Internal, err.Error()) } + ls := l.LivenessStatus( + clock.PhysicalTime(), + 0, /* threshold */ + clock.MaxOffset(), + ) + isHealthy := ls == storagepb.NodeLivenessStatus_LIVE if !isHealthy { return nil, grpcstatus.Error(codes.Unavailable, "node is not ready") } diff --git a/pkg/storage/node_liveness.go b/pkg/storage/node_liveness.go index f24796d1a0fd..4a8e2c5308b1 100644 --- a/pkg/storage/node_liveness.go +++ b/pkg/storage/node_liveness.go @@ -413,21 +413,6 @@ func (nl *NodeLiveness) IsLive(nodeID roachpb.NodeID) (bool, error) { return liveness.IsLive(nl.clock.Now(), nl.clock.MaxOffset()), nil } -// IsHealthy returns whether or not the specified node IsLive and is in a LIVE -// state, i.e. not draining, decommissioning, or otherwise unhealthy. -func (nl *NodeLiveness) IsHealthy(nodeID roachpb.NodeID) (bool, error) { - liveness, err := nl.GetLiveness(nodeID) - if err != nil { - return false, err - } - ls := liveness.LivenessStatus( - nl.clock.Now().GoTime(), - 0, /* threshold */ - nl.clock.MaxOffset(), - ) - return ls == storagepb.NodeLivenessStatus_LIVE, nil -} - // StartHeartbeat starts a periodic heartbeat to refresh this node's // last heartbeat in the node liveness table. The optionally provided // HeartbeatCallback will be invoked whenever this node updates its own liveness.