From 8202873c6da73694bd4b041105657e93a92b9bce Mon Sep 17 00:00:00 2001 From: jimczi Date: Tue, 17 Mar 2020 13:26:26 +0100 Subject: [PATCH] Adapt serialization version checks in ShardSearchRequest This change adapts the serialization checks to 7.7.0 in order to cope with #53659. Note that this commit also disables the bwc tests temporarily in order to be able to merge #53659 first. Relates #51852 --- build.gradle | 4 ++-- .../elasticsearch/search/internal/ShardSearchRequest.java | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 2dbf94ae7dabb..b83f19efbba42 100644 --- a/build.gradle +++ b/build.gradle @@ -221,8 +221,8 @@ task verifyVersions { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = true -final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */ +boolean bwc_tests_enabled = false +final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/53659" /* 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/search/internal/ShardSearchRequest.java b/server/src/main/java/org/elasticsearch/search/internal/ShardSearchRequest.java index 6c1fc7e959b40..96d0d67812d3c 100644 --- a/server/src/main/java/org/elasticsearch/search/internal/ShardSearchRequest.java +++ b/server/src/main/java/org/elasticsearch/search/internal/ShardSearchRequest.java @@ -179,12 +179,9 @@ public ShardSearchRequest(StreamInput in) throws IOException { preference = in.readOptionalString(); if (in.getVersion().onOrAfter(Version.V_7_7_0)) { canReturnNullResponseIfMatchNoDocs = in.readBoolean(); - } else { - canReturnNullResponseIfMatchNoDocs = false; - } - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { bottomSortValues = in.readOptionalWriteable(SearchSortValuesAndFormats::new); } else { + canReturnNullResponseIfMatchNoDocs = false; bottomSortValues = null; } originalIndices = OriginalIndices.readOriginalIndices(in); @@ -223,8 +220,6 @@ protected final void innerWriteTo(StreamOutput out, boolean asKey) throws IOExce } if (out.getVersion().onOrAfter(Version.V_7_7_0)) { out.writeBoolean(canReturnNullResponseIfMatchNoDocs); - } - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { out.writeOptionalWriteable(bottomSortValues); } }