From fc813fe6134577af7ab0239ca663c34a788f5f61 Mon Sep 17 00:00:00 2001 From: Gordon Brown Date: Thu, 6 Dec 2018 11:32:06 -0700 Subject: [PATCH 1/4] Remove 'INFO' deprecation level 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. --- .../migration/apis/deprecation.asciidoc | 24 +++++++++---------- .../core/deprecation/DeprecationIssue.java | 9 +++++-- .../xpack/deprecation/DeprecationChecks.java | 1 - .../deprecation/IndexDeprecationChecks.java | 17 ------------- 4 files changed, 18 insertions(+), 33 deletions(-) diff --git a/docs/reference/migration/apis/deprecation.asciidoc b/docs/reference/migration/apis/deprecation.asciidoc index 03ce69ff219dd..c507b780389ca 100644 --- a/docs/reference/migration/apis/deprecation.asciidoc +++ b/docs/reference/migration/apis/deprecation.asciidoc @@ -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-60}/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-60}/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. |======= diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/deprecation/DeprecationIssue.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/deprecation/DeprecationIssue.java index ff1b0d303d022..85a7edd109386 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/deprecation/DeprecationIssue.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/deprecation/DeprecationIssue.java @@ -23,9 +23,14 @@ 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 ; diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java index b03b79dae2fe6..2589cb80cb504 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DeprecationChecks.java @@ -38,7 +38,6 @@ private DeprecationChecks() { static List> INDEX_SETTINGS_CHECKS = Collections.unmodifiableList(Arrays.asList( IndexDeprecationChecks::baseSimilarityDefinedCheck, - IndexDeprecationChecks::coercionCheck, IndexDeprecationChecks::dynamicTemplateWithMatchMappingTypeCheck, IndexDeprecationChecks::indexSharedFileSystemCheck, IndexDeprecationChecks::indexStoreTypeCheck, diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java index 273fe1dec9d20..fcc6532fc99fd 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java @@ -79,23 +79,6 @@ private static List findInPropertiesRecursively(String type, Map 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 issues = new ArrayList<>(); From 93aa8ac73df5bb1e70fa1422808a24cb19e8c654 Mon Sep 17 00:00:00 2001 From: Gordon Brown Date: Fri, 7 Dec 2018 08:54:39 -0700 Subject: [PATCH 2/4] Update HLRC --- .../elasticsearch/client/migration/DeprecationInfoResponse.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/DeprecationInfoResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/DeprecationInfoResponse.java index 81d052ee16a5e..05e4be37edcfa 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/DeprecationInfoResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/DeprecationInfoResponse.java @@ -141,8 +141,6 @@ public static class DeprecationIssue { } public enum Level { - NONE, - INFO, WARNING, CRITICAL ; From 540e4311a58c63e18f288badfbcff0250a61fd3d Mon Sep 17 00:00:00 2001 From: Gordon Brown Date: Fri, 7 Dec 2018 09:04:04 -0700 Subject: [PATCH 3/4] Additional client fix --- .../client/migration/DeprecationInfoResponseTests.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/migration/DeprecationInfoResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/migration/DeprecationInfoResponseTests.java index b5b8512114d9d..054b800d6483c 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/migration/DeprecationInfoResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/migration/DeprecationInfoResponseTests.java @@ -30,6 +30,8 @@ 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 @@ private List createRandomIssues(boolea // 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)); From 97b9115ada12f79b22b7400b9e8a4d406623c3c2 Mon Sep 17 00:00:00 2001 From: Gordon Brown Date: Fri, 7 Dec 2018 09:04:37 -0700 Subject: [PATCH 4/4] Fix doc links in example --- docs/reference/migration/apis/deprecation.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reference/migration/apis/deprecation.asciidoc b/docs/reference/migration/apis/deprecation.asciidoc index c507b780389ca..5ff828bfa0c8a 100644 --- a/docs/reference/migration/apis/deprecation.asciidoc +++ b/docs/reference/migration/apis/deprecation.asciidoc @@ -51,7 +51,7 @@ Example response: { "level" : "critical", "message" : "Cluster name cannot contain ':'", - "url" : "{ref-60}/breaking-changes-7.0.html#_literal_literal_is_no_longer_allowed_in_cluster_name", + "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 ':'." } ], @@ -61,7 +61,7 @@ Example response: { "level" : "warning", "message" : "Index name cannot contain ':'", - "url" : "{ref-60}/breaking-changes-7.0.html#_literal_literal_is_no_longer_allowed_in_index_name", + "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 ':'." } ]