private NodeCandidate inGroup(int group, NodeCandidate candidate, int[] countInGroup) {
        candidate = unretire(candidate);
        if (candidate.allocation().get().membership().retired()) return candidate;
        var membership = candidate.allocation().get().membership();
        var currentGroup = membership.cluster().group();
        countInGroup[group]++;
        if ( ! currentGroup.isEmpty() && currentGroup.get().index() < requested.groups())
            countInGroup[membership.cluster().group().get().index()]--;
        return candidate.withNode(candidate.toNode().with(candidate.allocation().get().with(membership.with(membership.cluster().with(Optional.of(ClusterSpec.Group.from(group)))))));
    }
Unretire nodes that are already in the correct group when the group is deficient.
node-repository/src/main/java/com/yahoo/vespa/hosted/provision/provisioning/GroupAssigner.java