private Set<Integer> groupsWithNotRetiredAndNotUp(ClusterState clusterState) {
        return clusterInfo.getAllNodeInfos().stream()
                          .filter(nodeInfo -> (nodeInfo.getUserWantedState().getState() != RETIRED
                                               && nodeInfo.getUserWantedState().getState() != UP)
                                  || (clusterState.getNodeState(nodeInfo.getNode()).getState() != RETIRED
                                      && clusterState.getNodeState(nodeInfo.getNode()).getState() != UP))
                          .map(NodeInfo::getGroup)
                          .filter(Objects::nonNull)
                          .filter(Group::isLeafGroup)
                          .map(Group::getIndex)
                          .collect(Collectors.toSet());
    }
We want to check with the distributors to verify that it is safe to take down the storage node.
@param node the node to be checked
@param clusterStateVersion the cluster state we expect distributors to have
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/NodeStateChangeChecker.java