From 28354f541e9a75259b7811fcc5efeca71836c05c Mon Sep 17 00:00:00 2001 From: Gordon Brown Date: Fri, 6 Mar 2020 17:08:57 -0700 Subject: [PATCH] Fix hidden alias serialization version checks (#53249) This commit corrects the serialization versions for hidden alias data following the backport of #52547. --- build.gradle | 4 ++-- .../org/elasticsearch/action/admin/indices/alias/Alias.java | 4 ++-- .../action/admin/indices/alias/IndicesAliasesRequest.java | 4 ++-- .../org/elasticsearch/cluster/metadata/AliasMetaData.java | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index d6f9b3e7a172c..8176f88dab74c 100644 --- a/build.gradle +++ b/build.gradle @@ -220,8 +220,8 @@ task verifyVersions { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = false -final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/52547" // backport thereof +boolean bwc_tests_enabled = true +final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */ if (bwc_tests_enabled == false) { if (bwc_tests_disabled_issue.isEmpty()) { throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false") diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/Alias.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/Alias.java index a1fa218713aa5..46e21fa0c4418 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/Alias.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/Alias.java @@ -75,7 +75,7 @@ public Alias(StreamInput in) throws IOException { indexRouting = in.readOptionalString(); searchRouting = in.readOptionalString(); writeIndex = in.readOptionalBoolean(); - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { // TODO fix for backport of https://github.com/elastic/elasticsearch/pull/52547 + if (in.getVersion().onOrAfter(Version.V_7_7_0)) { isHidden = in.readOptionalBoolean(); } } @@ -219,7 +219,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString(indexRouting); out.writeOptionalString(searchRouting); out.writeOptionalBoolean(writeIndex); - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { // TODO fix for backport of https://github.com/elastic/elasticsearch/pull/52547 + if (out.getVersion().onOrAfter(Version.V_7_7_0)) { out.writeOptionalBoolean(isHidden); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java index 50a63a1e5227e..39f9d7239f5ce 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java @@ -251,7 +251,7 @@ public AliasActions(StreamInput in) throws IOException { searchRouting = in.readOptionalString(); indexRouting = in.readOptionalString(); writeIndex = in.readOptionalBoolean(); - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { //TODO fix for backport of https://github.com/elastic/elasticsearch/pull/52547 + if (in.getVersion().onOrAfter(Version.V_7_7_0)) { isHidden = in.readOptionalBoolean(); } originalAliases = in.readStringArray(); @@ -267,7 +267,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString(searchRouting); out.writeOptionalString(indexRouting); out.writeOptionalBoolean(writeIndex); - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { //TODO fix for backport https://github.com/elastic/elasticsearch/pull/52547 + if (out.getVersion().onOrAfter(Version.V_7_7_0)) { out.writeOptionalBoolean(isHidden); } out.writeStringArray(originalAliases); diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetaData.java index f5cdbc479e66e..99ba5a703f6a2 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/AliasMetaData.java @@ -198,7 +198,7 @@ public void writeTo(StreamOutput out) throws IOException { } out.writeOptionalBoolean(writeIndex()); - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { //TODO fix for backport of https://github.com/elastic/elasticsearch/pull/52547 + if (out.getVersion().onOrAfter(Version.V_7_7_0)) { out.writeOptionalBoolean(isHidden); } } @@ -224,7 +224,7 @@ public AliasMetaData(StreamInput in) throws IOException { } writeIndex = in.readOptionalBoolean(); - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { //TODO fix for backport of https://github.com/elastic/elasticsearch/pull/52547 + if (in.getVersion().onOrAfter(Version.V_7_7_0)) { isHidden = in.readOptionalBoolean(); } else { isHidden = null;