Simplify deprecation issue levels (#36326)

This commit gets rid of the 'NONE' and 'INFO' severity levels for
deprecation issues.

'NONE' is unused and does not make much sense as a severity level.
'INFO' can be separated into two categories: Either 1) we can
definitively tell there will be a problem with the cluster/node/index
configuration that can be resolved prior to upgrade, in which case
the issue should be a WARNING, or 2) we can't, because any issues would
be at the application level, for which the user should review the
deprecation logs and/or response headers.
This commit is contained in:
Gordon Brown 2018-12-07 15:45:53 -07:00 committed by GitHub
parent 2ba023be8a
commit 85bba0c3ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 36 deletions

View File

@ -141,8 +141,6 @@ public class DeprecationInfoResponse {
}
public enum Level {
NONE,
INFO,
WARNING,
CRITICAL
;

View File

@ -30,6 +30,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.elasticsearch.client.migration.DeprecationInfoResponse.DeprecationIssue.Level.CRITICAL;
import static org.elasticsearch.client.migration.DeprecationInfoResponse.DeprecationIssue.Level.WARNING;
import static org.elasticsearch.test.AbstractXContentTestCase.xContentTester;
public class DeprecationInfoResponseTests extends ESTestCase {
@ -94,7 +96,7 @@ public class DeprecationInfoResponseTests extends ESTestCase {
// of elements for this list.
int startingRandomNumber = canBeEmpty ? 0: 1;
for (int i =0; i < randomIntBetween(startingRandomNumber, 2); i++) {
list.add(new DeprecationInfoResponse.DeprecationIssue(DeprecationInfoResponse.DeprecationIssue.Level.INFO,
list.add(new DeprecationInfoResponse.DeprecationIssue(randomFrom(WARNING, CRITICAL),
randomAlphaOfLength(5),
randomAlphaOfLength(5),
randomBoolean() ? randomAlphaOfLength(5) : null));

View File

@ -49,20 +49,20 @@ Example response:
{
"cluster_settings" : [
{
"level" : "info",
"message" : "Network settings changes",
"url" : "{ref-60}/breaking_60_indices_changes.html#_index_templates_use_literal_index_patterns_literal_instead_of_literal_template_literal",
"details" : "templates using `template` field: watches,.monitoring-alerts,.watch-history-6,.ml-notifications,security-index-template,triggered_watches,.monitoring-es,.ml-meta,.ml-state,.monitoring-logstash,.ml-anomalies-,.monitoring-kibana"
"level" : "critical",
"message" : "Cluster name cannot contain ':'",
"url" : "{ref}/breaking-changes-7.0.html#_literal_literal_is_no_longer_allowed_in_cluster_name",
"details" : "This cluster is named [mycompany:logging], which contains the illegal character ':'."
}
],
"node_settings" : [ ],
"index_settings" : {
".monitoring-es-6-2017.07.21" : [
"logs:apache" : [
{
"level" : "info",
"message" : "Coercion of boolean fields",
"url" : "{ref-60}/breaking_60_mappings_changes.html#_coercion_of_boolean_fields",
"details" : "[[type: doc, field: spins], [type: doc, field: mlockall], [type: doc, field: node_master], [type: doc, field: primary]]"
"level" : "warning",
"message" : "Index name cannot contain ':'",
"url" : "{ref}/breaking-changes-7.0.html#_literal_literal_is_no_longer_allowed_in_index_name",
"details" : "This index is named [logs:apache], which contains the illegal character ':'."
}
]
}
@ -79,7 +79,7 @@ The following is an example deprecation warning:
["source","js",subs="attributes,callouts,macros"]
--------------------------------------------------
{
"level" : "info",
"level" : "warning",
"message" : "This is the generic descriptive message of the breaking change",
"url" : "{ref-60}/breaking_60_indices_changes.html",
"details" : "more information, like which nodes, indices, or settings are to blame"
@ -91,10 +91,8 @@ As is shown, there is a `level` property that describes the significance of the
issue.
|=======
|none | Everything is good.
|info | An advisory note that something has changed. No action needed.
|warning | You can upgrade directly, but you are using deprecated functionality
which will not be available in the next major version.
which will not be available or behave differently in the next major version.
|critical | You cannot upgrade without fixing this problem.
|=======

View File

@ -23,9 +23,14 @@ import java.util.Objects;
public class DeprecationIssue implements Writeable, ToXContentObject {
public enum Level implements Writeable {
NONE,
INFO,
/**
* Resolving this issue is advised but not required to upgrade. There may be undesired changes in behavior unless this issue is
* resolved before upgrading.
*/
WARNING,
/**
* This issue must be resolved to upgrade. Failures will occur unless this is resolved before upgrading.
*/
CRITICAL
;

View File

@ -38,7 +38,6 @@ public class DeprecationChecks {
static List<Function<IndexMetaData, DeprecationIssue>> INDEX_SETTINGS_CHECKS =
Collections.unmodifiableList(Arrays.asList(
IndexDeprecationChecks::baseSimilarityDefinedCheck,
IndexDeprecationChecks::coercionCheck,
IndexDeprecationChecks::dynamicTemplateWithMatchMappingTypeCheck,
IndexDeprecationChecks::indexSharedFileSystemCheck,
IndexDeprecationChecks::indexStoreTypeCheck,

View File

@ -79,23 +79,6 @@ public class IndexDeprecationChecks {
return issues;
}
static DeprecationIssue coercionCheck(IndexMetaData indexMetaData) {
if (indexMetaData.getCreationVersion().before(Version.V_6_0_0_alpha1)) {
List<String> issues = new ArrayList<>();
fieldLevelMappingIssue(indexMetaData, (mappingMetaData, sourceAsMap) -> {
issues.addAll(findInPropertiesRecursively(mappingMetaData.type(), sourceAsMap,
property -> "boolean".equals(property.get("type"))));
});
if (issues.size() > 0) {
return new DeprecationIssue(DeprecationIssue.Level.INFO, "Coercion of boolean fields",
"https://www.elastic.co/guide/en/elasticsearch/reference/master/" +
"breaking_60_mappings_changes.html#_coercion_of_boolean_fields",
issues.toString());
}
}
return null;
}
static DeprecationIssue dynamicTemplateWithMatchMappingTypeCheck(IndexMetaData indexMetaData) {
if (indexMetaData.getCreationVersion().before(Version.V_6_0_0_alpha1)) {
List<String> issues = new ArrayList<>();