Skip to content

Commit

Permalink
reset
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx committed Jan 22, 2025
1 parent b806fa3 commit 5a1eefe
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 5a1eefe

Please sign in to comment.