Skip to content

Commit

Permalink
liveness: remove unused GetIsLiveMap
Browse files Browse the repository at this point in the history
All the code has been changed to no longer require the GetIsLiveMap
function anymore.

Epic: none

Release note: None
  • Loading branch information
andrewbaptist committed Jun 27, 2023
1 parent 36d9efd commit 12d22e6
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 44 deletions.
22 changes: 0 additions & 22 deletions pkg/kv/kvserver/liveness/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,28 +205,6 @@ func (c *cache) GetLiveness(nodeID roachpb.NodeID) (_ Record, ok bool) {
return Record{}, false
}

// GetIsLiveMap returns a map of nodeID to boolean liveness status of
// each node. This excludes nodes that were removed completely (dead +
// decommissioned)
func (c *cache) GetIsLiveMap() livenesspb.IsLiveMap {
lMap := livenesspb.IsLiveMap{}
c.mu.RLock()
defer c.mu.RUnlock()
now := c.clock.Now()
for nID, l := range c.mu.nodes {
isLive := l.IsLive(now)
if l.Membership.Decommissioned() {
// This is a node that was completely removed. Skip over it.
continue
}
lMap[nID] = livenesspb.IsLiveMapEntry{
Liveness: l.Liveness,
IsLive: isLive,
}
}
return lMap
}

// getAllLivenessEntries returns a copy of all the entries currently in the
// liveness cache. Most places should avoid calling this method and instead just
// get the entry they need. In a few places in the code it is more efficient to
Expand Down
8 changes: 0 additions & 8 deletions pkg/kv/kvserver/liveness/liveness.go
Original file line number Diff line number Diff line change
Expand Up @@ -944,14 +944,6 @@ func (nl *NodeLiveness) Self() (_ livenesspb.Liveness, ok bool) {
return rec.Liveness, true
}

// GetIsLiveMap returns a map of nodeID to boolean liveness status of
// each node. This excludes nodes that were removed completely (dead +
// decommissioning).
// TODO(baptist): Remove.
func (nl *NodeLiveness) GetIsLiveMap() livenesspb.IsLiveMap {
return nl.cache.GetIsLiveMap()
}

// ScanNodeVitalityFromCache returns a map of nodeID to boolean liveness status
// of each node from the cache. This excludes nodes that were decommissioned.
// Decommissioned nodes are kept in the KV store and the cache forever, but are
Expand Down
14 changes: 0 additions & 14 deletions pkg/kv/kvserver/liveness/livenesspb/liveness.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,6 @@ func ValidateTransition(old Liveness, newStatus MembershipStatus) (bool, error)
return true, nil
}

// IsLiveMapEntry encapsulates data about current liveness for a
// node based on the liveness range.
// TODO(abaptist): This should only be used for epoch leases as it uses an
// overly strict version of liveness. Once epoch leases are removed, this will
// be also.
type IsLiveMapEntry struct {
Liveness
IsLive bool
}

// IsLiveMap is a type alias for a map from NodeID to IsLiveMapEntry.
type IsLiveMap map[roachpb.NodeID]IsLiveMapEntry

// NodeVitality should be used any place other than epoch leases where it is
// necessary to determine if a node is currently alive and what its health is.
// Aliveness and deadness are concepts that refer to our best guess of the
Expand Down Expand Up @@ -273,7 +260,6 @@ func (nv NodeVitality) IsLive(usage VitalityUsage) bool {
// waiting until it is definitely dead.
return nv.isAliveEpoch()
}

// TODO(baptist): Should be an assertion that we don't know this uasge.
return false
}
Expand Down

0 comments on commit 12d22e6

Please sign in to comment.