From 30241d106cc4f5cf54e709ac1801032e51a3153d Mon Sep 17 00:00:00 2001 From: Przemyslaw Witek Date: Thu, 21 Jan 2021 14:52:37 +0100 Subject: [PATCH 1/2] [Transform] finish backport: adapt versions to 7.12 --- build.gradle | 4 ++-- .../xpack/core/transform/transforms/SourceConfig.java | 11 ++--------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 5d21fea9b04fe..6e8b10cf878d9 100644 --- a/build.gradle +++ b/build.gradle @@ -175,8 +175,8 @@ tasks.register("verifyVersions") { * after the backport of the backcompat code is complete. */ -boolean bwc_tests_enabled = false -String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/67821" /* place a PR link here when committing bwc changes */ +boolean bwc_tests_enabled = true +String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */ /* * FIPS 140-2 behavior was fixed in 7.11.0. Before that there is no way to run elasticsearch in a * JVM that is properly configured to be in fips mode with BCFIPS. For now we need to disable diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SourceConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SourceConfig.java index 5fc0fdafcf477..cd36be19b2282 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SourceConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SourceConfig.java @@ -6,7 +6,6 @@ package org.elasticsearch.xpack.core.transform.transforms; -import org.elasticsearch.Version; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; @@ -97,11 +96,7 @@ public SourceConfig(String[] index, QueryConfig queryConfig, Map public SourceConfig(final StreamInput in) throws IOException { index = in.readStringArray(); queryConfig = new QueryConfig(in); - if (in.getVersion().onOrAfter(Version.V_8_0_0)) { - runtimeMappings = in.readMap(); - } else { - runtimeMappings = Collections.emptyMap(); - } + runtimeMappings = in.readMap(); } public String[] getIndex() { @@ -128,9 +123,7 @@ public boolean requiresRemoteCluster() { public void writeTo(StreamOutput out) throws IOException { out.writeStringArray(index); queryConfig.writeTo(out); - if (out.getVersion().onOrAfter(Version.V_8_0_0)) { - out.writeMap(runtimeMappings); - } + out.writeMap(runtimeMappings); } @Override From 50aa2b925f953237e9ef839a0240aa45925f10c9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Witek Date: Thu, 21 Jan 2021 15:17:34 +0100 Subject: [PATCH 2/2] Fix unit test --- .../xpack/core/transform/transforms/SourceConfig.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SourceConfig.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SourceConfig.java index cd36be19b2282..b06affd3942b1 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SourceConfig.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SourceConfig.java @@ -6,6 +6,7 @@ package org.elasticsearch.xpack.core.transform.transforms; +import org.elasticsearch.Version; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.StreamInput; @@ -96,7 +97,11 @@ public SourceConfig(String[] index, QueryConfig queryConfig, Map public SourceConfig(final StreamInput in) throws IOException { index = in.readStringArray(); queryConfig = new QueryConfig(in); - runtimeMappings = in.readMap(); + if (in.getVersion().onOrAfter(Version.V_7_12_0)) { + runtimeMappings = in.readMap(); + } else { + runtimeMappings = Collections.emptyMap(); + } } public String[] getIndex() { @@ -123,7 +128,9 @@ public boolean requiresRemoteCluster() { public void writeTo(StreamOutput out) throws IOException { out.writeStringArray(index); queryConfig.writeTo(out); - out.writeMap(runtimeMappings); + if (out.getVersion().onOrAfter(Version.V_7_12_0)) { + out.writeMap(runtimeMappings); + } } @Override