code: protected Set<ClusterNode.GrantId> deleteNode(ClusterNode node) {
      synchronized (node) {
        if (node.deleted) {
          return null;
        }
  
        node.deleted = true;
        // 1: primary
        nameToNode.remove(node.getName());
        faultManager.deleteNode(node.getName());
        nameToApps.remove(node.getName());
        hostsToSessions.remove(node);
        setAliveDeadMetrics();
  
        // 2: update runnable index
        for (RunnableIndices r : typeToIndices.values()) {
          r.deleteRunnable(node);
        }
        return node.getGrants();
      }
    }
docs: Delete the node from the cluster. This happens when the node times out
  or is being decommissioned.
  @param node the node to remove
  @return the list of grants that are running on the node