The following test fails reproducibly in current `main` (af071ccc314a0975a9b6e1b6ce7d2a9f92d75a09):

    ./gradlew ':server:test' --tests "org.elasticsearch.cluster.coordination.AtomicRegisterCoordinatorTests.testClusterRecoversAfterExceptionDuringSerialization" -Dtests.seed=E6F4C7552A14BE28
server/src/main/java/org/elasticsearch/gateway/GatewayService.java
reason = "recover_after_time was set to [" + recoverAfterTime + "]";
            } else if (expectedDataNodes <= nodes.getDataNodes().size()) {
                
                enforceRecoverAfterTime = false;
                reason = "";
            } else {
                
                enforceRecoverAfterTime = true;
                reason = "expecting [" + expectedDataNodes + "] data nodes, but only have [" + nodes.getDataNodes().size() + "]";
            }
            performStateRecovery(enforceRecoverAfterTime, reason);
        }
    }
    private void performStateRecovery(final boolean enforceRecoverAfterTime, final String reason) {
        if (enforceRecoverAfterTime && recoverAfterTime != null) {
            if (scheduledRecovery.compareAndSet(false, true)) {
                logger.info("delaying initial state recovery for [{}]. {}", recoverAfterTime, reason);
                threadPool.schedule(new AbstractRunnable() {
                    @Override
                    public void onFailure(Exception e) {
                        logger.warn("delayed state recovery failed", e);
                        resetRecoveredFlags();
                    }
                    @Override
                    protected void doRun() {
                        if (recoveryInProgress.compareAndSet(false, true)) {
                            logger.info("recover_after_time [{}] elapsed. performing state recovery...", recoverAfterTime);
                            runRecovery();
                        }
                    }