Quellcode durchsuchen

More 9.2 migrations (#133844)

More transport version migrations for 9.2

ES-12334
Jack Conradson vor 1 Monat
Ursprung
Commit
8d9f03898f

+ 0 - 2
server/src/main/java/org/elasticsearch/TransportVersions.java

@@ -353,8 +353,6 @@ public class TransportVersions {
     public static final TransportVersion ML_INFERENCE_LLAMA_ADDED = def(9_125_0_00);
     public static final TransportVersion SHARD_WRITE_LOAD_IN_CLUSTER_INFO = def(9_126_0_00);
     public static final TransportVersion ESQL_SAMPLE_OPERATOR_STATUS = def(9_127_0_00);
-    public static final TransportVersion ALLOCATION_DECISION_NOT_PREFERRED = def(9_145_0_00);
-    public static final TransportVersion ESQL_QUALIFIERS_IN_ATTRIBUTES = def(9_146_0_00);
     public static final TransportVersion PROJECT_RESERVED_STATE_MOVE_TO_REGISTRY = def(9_147_0_00);
 
     /*

+ 7 - 3
server/src/main/java/org/elasticsearch/cluster/routing/allocation/decider/Decision.java

@@ -9,7 +9,7 @@
 
 package org.elasticsearch.cluster.routing.allocation.decider;
 
-import org.elasticsearch.TransportVersions;
+import org.elasticsearch.TransportVersion;
 import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
 import org.elasticsearch.common.io.stream.Writeable;
@@ -115,8 +115,12 @@ public sealed interface Decision extends ToXContent, Writeable permits Decision.
         NOT_PREFERRED,
         YES;
 
+        private static final TransportVersion ALLOCATION_DECISION_NOT_PREFERRED = TransportVersion.fromName(
+            "allocation_decision_not_preferred"
+        );
+
         public static Type readFrom(StreamInput in) throws IOException {
-            if (in.getTransportVersion().onOrAfter(TransportVersions.ALLOCATION_DECISION_NOT_PREFERRED)) {
+            if (in.getTransportVersion().supports(ALLOCATION_DECISION_NOT_PREFERRED)) {
                 return in.readEnum(Type.class);
             } else {
                 int i = in.readVInt();
@@ -138,7 +142,7 @@ public sealed interface Decision extends ToXContent, Writeable permits Decision.
 
         @Override
         public void writeTo(StreamOutput out) throws IOException {
-            if (out.getTransportVersion().onOrAfter(TransportVersions.ALLOCATION_DECISION_NOT_PREFERRED)) {
+            if (out.getTransportVersion().supports(ALLOCATION_DECISION_NOT_PREFERRED)) {
                 out.writeEnum(this);
             } else {
                 out.writeVInt(switch (this) {

+ 1 - 0
server/src/main/resources/transport/definitions/referable/allocation_decision_not_preferred.csv

@@ -0,0 +1 @@
+9145000

+ 1 - 0
server/src/main/resources/transport/definitions/referable/esql_qualifiers_in_attributes.csv

@@ -0,0 +1 @@
+9146000

+ 1 - 1
server/src/main/resources/transport/upper_bounds/9.2.csv

@@ -1 +1 @@
-esql_lookup_operator_emitted_rows,9144000
+esql_qualifiers_in_attributes,9146000

+ 4 - 3
x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/Attribute.java

@@ -18,7 +18,6 @@ import java.util.List;
 import java.util.Objects;
 
 import static java.util.Collections.emptyList;
-import static org.elasticsearch.TransportVersions.ESQL_QUALIFIERS_IN_ATTRIBUTES;
 
 /**
  * {@link Expression}s that can be materialized and describe properties of the derived table.
@@ -38,6 +37,8 @@ public abstract class Attribute extends NamedExpression {
      */
     protected static final String SYNTHETIC_ATTRIBUTE_NAME_PREFIX = "$$";
 
+    private static final TransportVersion ESQL_QUALIFIERS_IN_ATTRIBUTES = TransportVersion.fromName("esql_qualifiers_in_attributes");
+
     // can the attr be null
     private final Nullability nullability;
     private final String qualifier;
@@ -204,7 +205,7 @@ public abstract class Attribute extends NamedExpression {
     public abstract boolean isDimension();
 
     protected void checkAndSerializeQualifier(PlanStreamOutput out, TransportVersion version) throws IOException {
-        if (version.onOrAfter(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
+        if (version.supports(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
             out.writeOptionalCachedString(qualifier());
         } else if (qualifier() != null) {
             // Non-null qualifier means the query specifically defined one. Old nodes don't know what to do with it and just writing
@@ -215,7 +216,7 @@ public abstract class Attribute extends NamedExpression {
     }
 
     protected static String readQualifier(PlanStreamInput in, TransportVersion version) throws IOException {
-        if (version.onOrAfter(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
+        if (version.supports(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
             return in.readOptionalCachedString();
         }
         return null;

+ 5 - 4
x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/ReferenceAttribute.java

@@ -6,6 +6,7 @@
  */
 package org.elasticsearch.xpack.esql.core.expression;
 
+import org.elasticsearch.TransportVersion;
 import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
 import org.elasticsearch.common.io.stream.StreamInput;
 import org.elasticsearch.common.io.stream.StreamOutput;
@@ -18,8 +19,6 @@ import org.elasticsearch.xpack.esql.core.util.PlanStreamOutput;
 
 import java.io.IOException;
 
-import static org.elasticsearch.TransportVersions.ESQL_QUALIFIERS_IN_ATTRIBUTES;
-
 /**
  * Attribute based on a reference to an expression.
  */
@@ -30,6 +29,8 @@ public class ReferenceAttribute extends TypedAttribute {
         ReferenceAttribute::readFrom
     );
 
+    private static final TransportVersion ESQL_QUALIFIERS_IN_ATTRIBUTES = TransportVersion.fromName("esql_qualifiers_in_attributes");
+
     @Deprecated
     /**
      * Only used for tests
@@ -61,7 +62,7 @@ public class ReferenceAttribute extends TypedAttribute {
             out.writeString(name());
             dataType().writeTo(out);
             checkAndSerializeQualifier((PlanStreamOutput) out, out.getTransportVersion());
-            if (out.getTransportVersion().before(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
+            if (out.getTransportVersion().supports(ESQL_QUALIFIERS_IN_ATTRIBUTES) == false) {
                 // We used to always serialize a null qualifier here, so do the same for bwc.
                 out.writeOptionalString(null);
             }
@@ -89,7 +90,7 @@ public class ReferenceAttribute extends TypedAttribute {
         String name = in.readString();
         DataType dataType = DataType.readFrom(in);
         String qualifier = readQualifier((PlanStreamInput) in, in.getTransportVersion());
-        if (in.getTransportVersion().before(ESQL_QUALIFIERS_IN_ATTRIBUTES)) {
+        if (in.getTransportVersion().supports(ESQL_QUALIFIERS_IN_ATTRIBUTES) == false) {
             in.readOptionalString();
         }
         Nullability nullability = in.readEnum(Nullability.class);