Skip to content

Commit

Permalink
[8.x] Follow ups after Add Index Block API changes for N-2 support (e…
Browse files Browse the repository at this point in the history
…lastic#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 elastic#120526
  • Loading branch information
tlrx authored Jan 22, 2025
1 parent 280ab31 commit 37e39f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,11 @@ private static boolean isReadOnlyCompatible(
}

private static boolean hasIndexWritesBlock(IndexMetadata indexMetadata) {
if (IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.get(indexMetadata.getSettings())) {
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(indexMetadata.getSettings());
|| MetadataIndexStateService.VERIFIED_READ_ONLY_SETTING.get(indexSettings);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.Build;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionListener;
Expand Down Expand Up @@ -121,8 +120,7 @@ public class MetadataIndexStateService {
false,
Setting.Property.IndexScope,
Setting.Property.NotCopyableOnResize,
// Allow the setting to be updated in snapshot builds
Build.current().isSnapshot() ? Setting.Property.OperatorDynamic : Setting.Property.PrivateIndex
Setting.Property.PrivateIndex
);

private final ClusterService clusterService;
Expand Down

0 comments on commit 37e39f4

Please sign in to comment.