diff --git a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java index d354fdb7aac..6e09cd6ec30 100644 --- a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java +++ b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java @@ -404,6 +404,7 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp public void updateState(ClusterState state) { metadata = getRepoMetadata(state); uncleanStart = uncleanStart && metadata.generation() != metadata.pendingGeneration(); + final boolean wasBestEffortConsistency = bestEffortConsistency; bestEffortConsistency = uncleanStart || isReadOnly() || state.nodes().getMinNodeVersion().before(RepositoryMetadata.REPO_GEN_IN_CS_VERSION) || metadata.generation() == RepositoryData.UNKNOWN_REPO_GEN || ALLOW_CONCURRENT_MODIFICATION.get(metadata.settings()); @@ -430,8 +431,9 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp } else { final long previousBest = latestKnownRepoGen.getAndSet(metadata.generation()); if (previousBest != metadata.generation()) { - assert metadata.generation() == RepositoryData.CORRUPTED_REPO_GEN || previousBest < metadata.generation() : - "Illegal move from repository generation [" + previousBest + "] to generation [" + metadata.generation() + "]"; + assert wasBestEffortConsistency || metadata.generation() == RepositoryData.CORRUPTED_REPO_GEN + || previousBest < metadata.generation() : "Illegal move from repository generation [" + previousBest + + "] to generation [" + metadata.generation() + "]"; logger.debug("Updated repository generation from [{}] to [{}]", previousBest, metadata.generation()); } }