Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add frozen index deprecation check. #78915

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ private DeprecationChecks() {
IndexDeprecationChecks::oldIndicesCheck,
IndexDeprecationChecks::translogRetentionSettingCheck,
IndexDeprecationChecks::checkIndexDataPath,
IndexDeprecationChecks::storeTypeSettingCheck
IndexDeprecationChecks::storeTypeSettingCheck,
IndexDeprecationChecks::frozenIndexSettingCheck
);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.engine.frozen.FrozenEngine;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;

import java.util.Locale;
Expand Down Expand Up @@ -73,4 +74,21 @@ static DeprecationIssue storeTypeSettingCheck(IndexMetadata indexMetadata) {
}
return null;
}

static DeprecationIssue frozenIndexSettingCheck(IndexMetadata indexMetadata) {
Boolean isIndexFrozen = FrozenEngine.INDEX_FROZEN.get(indexMetadata.getSettings());
if (Boolean.TRUE.equals(isIndexFrozen)) {
String indexName = indexMetadata.getIndex().getName();
return new DeprecationIssue(
DeprecationIssue.Level.WARNING,
"index [" + indexName +
"] is a frozen index. The frozen indices feature is deprecated and will be removed in a future version",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/frozen-indices.html",
"Frozen indices no longer offer any advantages. Consider cold or frozen tiers in place of frozen indices.",
false,
null
);
}
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.IndexModule;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.engine.frozen.FrozenEngine;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;

Expand Down Expand Up @@ -96,4 +97,20 @@ public void testSimpleFSSetting() {
"as it offers superior or equivalent performance to [simplefs].", false, null)
));
}

public void testFrozenIndex() {
Settings.Builder settings = settings(Version.CURRENT);
settings.put(FrozenEngine.INDEX_FROZEN.getKey(), true);
IndexMetadata indexMetadata = IndexMetadata.builder("test").settings(settings).numberOfShards(1).numberOfReplicas(0).build();
List<DeprecationIssue> issues = DeprecationChecks.filterChecks(INDEX_SETTINGS_CHECKS, c -> c.apply(indexMetadata));
assertThat(issues, contains(
new DeprecationIssue(DeprecationIssue.Level.WARNING,
"index [test] is a frozen index. The frozen indices feature is deprecated and will be removed in a future version",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/frozen-indices.html",
"Frozen indices no longer offer any advantages. Consider cold or frozen tiers in place of frozen indices.",
false,
null
)
));
}
}