private static Set<Integer> availableContentNodes(ClusterState baselineState) {
        final Set<Integer> availableNodes = new HashSet<>();
        final int nodeCount = baselineState.getNodeCount(NodeType.STORAGE);
        for (int nodeIndex = 0; nodeIndex < nodeCount; ++nodeIndex) {
            if (contentNodeIsAvailable(baselineState, nodeIndex)) {
                availableNodes.add(nodeIndex);
            }
        }
        return availableNodes;
    }
Cluster state deriver which checks if nodes have merges pending for globally
distributed documents, and if they do, sets the node in maintenance mode in the
default bucket space. This allows merges to complete for global documents before
the default space documents that have references to them are made searchable.

Note: bucket spaces are currently hard-coded.
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/MaintenanceWhenPendingGlobalMerges.java