From 3f2831160c915479fc52d806186ce330bbf0edb9 Mon Sep 17 00:00:00 2001 From: Nick Knize Date: Thu, 6 Jan 2022 13:11:31 -0600 Subject: [PATCH] [1.x] Remove remaining Flavor Serialization (#1751) (#1757) * [Remove] Remaining Flavor Serialization (#1751) This commit removes unnecessary serialization of unused flavor variable in build metadata from V_1_3_0+ Signed-off-by: Nicholas Walter Knize * change flavor version check to V_1_3_0 This commit changes the flavor serialization check in Build from V_2_0_0 to V_1_3_0. Signed-off-by: Nicholas Walter Knize --- server/src/main/java/org/opensearch/Build.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/src/main/java/org/opensearch/Build.java b/server/src/main/java/org/opensearch/Build.java index ef0dca64df9f4..af8b3b3be06b5 100644 --- a/server/src/main/java/org/opensearch/Build.java +++ b/server/src/main/java/org/opensearch/Build.java @@ -201,7 +201,6 @@ public String date() { public static Build readBuild(StreamInput in) throws IOException { final String distribution; - final String flavor; final Type type; // the following is new for opensearch: we write the distribution to support any "forks" if (in.getVersion().onOrAfter(Version.V_1_0_0)) { @@ -215,8 +214,8 @@ public static Build readBuild(StreamInput in) throws IOException { // TODO - clean this up when OSS flavor is removed in all of the code base // (Integ test zip still write OSS as distribution) // See issue: https://github.com/opendistro-for-elasticsearch/search/issues/159 - if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) { - flavor = in.readString(); + if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0) && in.getVersion().before(Version.V_1_3_0)) { + String flavor = in.readString(); } if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) { // be lenient when reading on the wire, the enumeration values from other versions might be different than what we know @@ -246,8 +245,7 @@ public static void writeBuild(Build build, StreamOutput out) throws IOException // The following block is kept for existing BWS tests to pass. // TODO - clean up this code when we remove all v6 bwc tests. // TODO - clean this up when OSS flavor is removed in all of the code base - // See issue: https://github.com/opendistro-for-elasticsearch/search/issues/159 - if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) { + if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0) && out.getVersion().before(Version.V_1_3_0)) { out.writeString("oss"); } if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {