Browse Source

[Transform] finish backport: adapt versions to 7.11 (#65961)

finalize the integration of #65584
Hendrik Muhs 4 years ago
parent
commit
7dbe7c1643

+ 2 - 2
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/SettingsConfig.java

@@ -72,7 +72,7 @@ public class SettingsConfig implements Writeable, ToXContentObject {
     public SettingsConfig(final StreamInput in) throws IOException {
         this.maxPageSearchSize = in.readOptionalInt();
         this.docsPerSecond = in.readOptionalFloat();
-        if (in.getVersion().onOrAfter(Version.V_8_0_0)) { // todo: change to V_7_11
+        if (in.getVersion().onOrAfter(Version.V_7_11_0)) {
             this.datesAsEpochMillis = in.readOptionalInt();
         } else {
             this.datesAsEpochMillis = DEFAULT_DATES_AS_EPOCH_MILLIS;
@@ -115,7 +115,7 @@ public class SettingsConfig implements Writeable, ToXContentObject {
     public void writeTo(StreamOutput out) throws IOException {
         out.writeOptionalInt(maxPageSearchSize);
         out.writeOptionalFloat(docsPerSecond);
-        if (out.getVersion().onOrAfter(Version.V_8_0_0)) {  // todo: change to V_7_11_0
+        if (out.getVersion().onOrAfter(Version.V_7_11_0)) {
             out.writeOptionalInt(datesAsEpochMillis);
         }
     }

+ 2 - 2
x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfig.java

@@ -455,7 +455,7 @@ public class TransformConfig extends AbstractDiffable<TransformConfig> implement
         // quick check if a rewrite is required, if none found just return the original
         // a failing quick check, does not mean a rewrite is necessary
         if (transformConfig.getVersion() != null
-            && transformConfig.getVersion().onOrAfter(Version.V_8_0_0) // todo: V_7_11_0
+            && transformConfig.getVersion().onOrAfter(Version.V_7_11_0)
             && (transformConfig.getPivotConfig() == null || transformConfig.getPivotConfig().getMaxPageSearchSize() == null)) {
             return transformConfig;
         }
@@ -491,7 +491,7 @@ public class TransformConfig extends AbstractDiffable<TransformConfig> implement
         }
 
         // 2. set dates_as_epoch_millis to true for transforms < 7.11 to keep BWC
-        if (builder.getVersion() != null && builder.getVersion().before(Version.V_8_0_0)) { // todo: V_7_11_0
+        if (builder.getVersion() != null && builder.getVersion().before(Version.V_7_11_0)) {
             builder.setSettings(
                 new SettingsConfig(builder.getSettings().getMaxPageSearchSize(), builder.getSettings().getDocsPerSecond(), true)
             );

+ 2 - 2
x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformConfigTests.java

@@ -421,12 +421,12 @@ public class TransformConfigTests extends AbstractSerializingTransformTestCase<T
 
         TransformConfig explicitTrueAfter711 = new TransformConfig.Builder(transformConfig).setSettings(
             new SettingsConfig.Builder(transformConfigRewritten.getSettings()).setDatesAsEpochMillis(true).build()
-        ).setVersion(Version.V_8_0_0).build(); // todo: V_7_11_0
+        ).setVersion(Version.V_7_11_0).build();
 
         transformConfigRewritten = TransformConfig.rewriteForUpdate(explicitTrueAfter711);
 
         assertTrue(transformConfigRewritten.getSettings().getDatesAsEpochMillis());
-        assertEquals(Version.V_8_0_0, transformConfigRewritten.getVersion()); // todo: V_7_11_0
+        assertEquals(Version.V_7_11_0, transformConfigRewritten.getVersion());
     }
 
     private TransformConfig createTransformConfigFromString(String json, String id) throws IOException {

+ 1 - 1
x-pack/plugin/transform/src/main/java/org/elasticsearch/xpack/transform/transforms/pivot/Pivot.java

@@ -228,7 +228,7 @@ public class Pivot implements Function {
         // >= 7.11 as string
         // note: it depends on the version when the transform has been created, not the version of the code
         boolean datesAsEpoch = settings.getDatesAsEpochMillis() != null ? settings.getDatesAsEpochMillis()
-            : version.onOrAfter(Version.V_8_0_0) ? false // todo V_7_11_0
+            : version.onOrAfter(Version.V_7_11_0) ? false
             : true;
 
         return AggregationResultUtils.extractCompositeAggregationResults(