diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifier.java b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifier.java index b8fa5102e12eb..05219d7f2c1a9 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifier.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifier.java @@ -163,7 +163,7 @@ public static boolean isReadOnlySupportedVersion( ) { if (isReadOnlyCompatible(indexMetadata, minimumCompatible, minimumReadOnlyCompatible)) { assert isFullySupportedVersion(indexMetadata, minimumCompatible) == false : indexMetadata; - final boolean isReadOnly = hasIndexWritesBlock(indexMetadata); + final boolean isReadOnly = hasReadOnlyBlocks(indexMetadata); if (isReadOnly == false) { throw new IllegalStateException( "The index " @@ -206,13 +206,16 @@ private static boolean isReadOnlyCompatible( return false; } - private static boolean hasIndexWritesBlock(IndexMetadata indexMetadata) { + private static boolean hasReadOnlyBlocks(IndexMetadata indexMetadata) { var indexSettings = indexMetadata.getSettings(); if (IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.get(indexSettings) || IndexMetadata.INDEX_READ_ONLY_SETTING.get(indexSettings)) { return indexMetadata.isSearchableSnapshot() || indexMetadata.getCreationVersion().isLegacyIndexVersion() || MetadataIndexStateService.VERIFIED_READ_ONLY_SETTING.get(indexSettings); } + if (indexMetadata.getState() == IndexMetadata.State.CLOSE) { + return MetadataIndexStateService.VERIFIED_BEFORE_CLOSE_SETTING.get(indexSettings); + } return false; }