Today the `ReservedClusterStateService` decides whether or not to submit an update-error task depending on the content of the last-applied state as exposed by `ClusterService#state()`. This may happen concurrently with another state being published, so does not give a fully consistent view of the latest state. Instead it should check the state within the cluster state task executor, triggering a no-op update as appropriate.
server/src/main/java/org/elasticsearch/reservedstate/service/ReservedClusterStateService.java
}
        submitErrorUpdateTask(errorState);
    }
    private void submitErrorUpdateTask(ErrorState errorState) {
        clusterService.submitStateUpdateTask(
            "reserved cluster state update error for [ " + errorState.namespace() + "]",
            new ReservedStateErrorTask(errorState, new ActionListener<>() {
                @Override
                public void onResponse(ActionResponse.Empty empty) {
                    logger.info("Successfully applied new reserved error state for namespace [{}]", errorState.namespace());
                }
                @Override
                public void onFailure(Exception e) {
                    logger.error("Failed to apply reserved error cluster state", e);
                }
            }),
            ClusterStateTaskConfig.build(Priority.URGENT),
            errorStateTaskExecutor
        );
    }
    /**
     * Goes through all of the handlers, runs the validation and the transform part of the cluster state.
     * <p>
     * While running the handlers we also collect any non cluster state transformation consumer actions that
     * need to be performed asynchronously before we attempt to save the cluster state. The trial run does not
     * result in an update of the cluster state, it's only purpose is to verify if we can correctly perform a
     * cluster state update with the given reserved state chunk.
     *
     * Package private for testing
     */