@Override
    public boolean mayHaveMergesPending(String bucketSpace, int contentNodeIndex) {
        if (!stats.hasUpdatesFromAllDistributors()) {
            return true;
        }
        ContentNodeStats nodeStats = stats.getStats().getNodeStats(contentNodeIndex);
        if (nodeStats != null) {
            ContentNodeStats.BucketSpaceStats bucketSpaceStats = nodeStats.getBucketSpace(bucketSpace);
            return (bucketSpaceStats != null &&
                    bucketSpaceStats.mayHaveBucketsPending(minMergeCompletionRatio));
        }
        return true;
    }
Class checking whether a particular bucket space on a content node might have buckets pending.

Aggregated stats over the entire content cluster is used to check this.
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/AggregatedStatsMergePendingChecker.java