Skip to content

Commit 37e39f4

Browse files
authored
[8.x] Follow ups after Add Index Block API changes for N-2 support (#120537)
Changes in 8.x to allow regular indices in version N-2 to recover using the index.block.read_only too. Also makes the index.verified_read_only private. Relates #120526
1 parent 280ab31 commit 37e39f4

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

server/src/main/java/org/elasticsearch/cluster/metadata/IndexMetadataVerifier.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,11 @@ private static boolean isReadOnlyCompatible(
207207
}
208208

209209
private static boolean hasIndexWritesBlock(IndexMetadata indexMetadata) {
210-
if (IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.get(indexMetadata.getSettings())) {
210+
var indexSettings = indexMetadata.getSettings();
211+
if (IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.get(indexSettings) || IndexMetadata.INDEX_READ_ONLY_SETTING.get(indexSettings)) {
211212
return indexMetadata.isSearchableSnapshot()
212213
|| indexMetadata.getCreationVersion().isLegacyIndexVersion()
213-
|| MetadataIndexStateService.VERIFIED_READ_ONLY_SETTING.get(indexMetadata.getSettings());
214+
|| MetadataIndexStateService.VERIFIED_READ_ONLY_SETTING.get(indexSettings);
214215
}
215216
return false;
216217
}

server/src/main/java/org/elasticsearch/cluster/metadata/MetadataIndexStateService.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import org.apache.logging.log4j.LogManager;
1313
import org.apache.logging.log4j.Logger;
14-
import org.elasticsearch.Build;
1514
import org.elasticsearch.ElasticsearchException;
1615
import org.elasticsearch.TransportVersions;
1716
import org.elasticsearch.action.ActionListener;
@@ -121,8 +120,7 @@ public class MetadataIndexStateService {
121120
false,
122121
Setting.Property.IndexScope,
123122
Setting.Property.NotCopyableOnResize,
124-
// Allow the setting to be updated in snapshot builds
125-
Build.current().isSnapshot() ? Setting.Property.OperatorDynamic : Setting.Property.PrivateIndex
123+
Setting.Property.PrivateIndex
126124
);
127125

128126
private final ClusterService clusterService;

0 commit comments

Comments
 (0)