diff --git a/build.gradle b/build.gradle index 2ed2c894d059..4a7952374e44 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 -final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/65689" /* place a PR link here when committing bwc changes */ +boolean bwc_tests_enabled = true +final String bwc_tests_disabled_issue = "" /* 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/index/shard/IndexLongFieldRange.java b/server/src/main/java/org/elasticsearch/index/shard/IndexLongFieldRange.java index 3f6a6b0be058..eb4b3ced2a14 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/IndexLongFieldRange.java +++ b/server/src/main/java/org/elasticsearch/index/shard/IndexLongFieldRange.java @@ -34,8 +34,6 @@ import java.util.Objects; import java.util.stream.IntStream; -import static org.elasticsearch.index.shard.ShardLongFieldRange.LONG_FIELD_RANGE_VERSION_INTRODUCED; - /** * Class representing an (inclusive) range of {@code long} values in a field in an index which may comprise multiple shards. This * information is accumulated shard-by-shard, and we keep track of which shards are represented in this value. Only once all shards are @@ -120,33 +118,26 @@ public long getMax() { @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(LONG_FIELD_RANGE_VERSION_INTRODUCED)) { - if (this == NO_SHARDS) { - out.writeByte(WIRE_TYPE_NO_SHARDS); - } else if (this == UNKNOWN) { - out.writeByte(WIRE_TYPE_UNKNOWN); - } else if (this == EMPTY) { - out.writeByte(WIRE_TYPE_EMPTY); + if (this == NO_SHARDS) { + out.writeByte(WIRE_TYPE_NO_SHARDS); + } else if (this == UNKNOWN) { + out.writeByte(WIRE_TYPE_UNKNOWN); + } else if (this == EMPTY) { + out.writeByte(WIRE_TYPE_EMPTY); + } else { + out.writeByte(WIRE_TYPE_OTHER); + if (shards == null) { + out.writeBoolean(false); } else { - out.writeByte(WIRE_TYPE_OTHER); - if (shards == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - out.writeVIntArray(shards); - } - out.writeZLong(min); - out.writeZLong(max); + out.writeBoolean(true); + out.writeVIntArray(shards); } + out.writeZLong(min); + out.writeZLong(max); } } public static IndexLongFieldRange readFrom(StreamInput in) throws IOException { - if (in.getVersion().before(LONG_FIELD_RANGE_VERSION_INTRODUCED)) { - // conservative treatment for BWC - return UNKNOWN; - } - final byte type = in.readByte(); switch (type) { case WIRE_TYPE_NO_SHARDS: diff --git a/server/src/main/java/org/elasticsearch/index/shard/ShardLongFieldRange.java b/server/src/main/java/org/elasticsearch/index/shard/ShardLongFieldRange.java index b76cf2d89bc9..f05c35331404 100644 --- a/server/src/main/java/org/elasticsearch/index/shard/ShardLongFieldRange.java +++ b/server/src/main/java/org/elasticsearch/index/shard/ShardLongFieldRange.java @@ -19,7 +19,6 @@ package org.elasticsearch.index.shard; -import org.elasticsearch.Version; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.Writeable; @@ -32,8 +31,6 @@ */ public class ShardLongFieldRange implements Writeable { - public static final Version LONG_FIELD_RANGE_VERSION_INTRODUCED = Version.V_8_0_0; - /** * Sentinel value indicating an empty range, for instance because the field is missing or has no values. */ @@ -91,11 +88,6 @@ public String toString() { private static final byte WIRE_TYPE_EMPTY = (byte)2; public static ShardLongFieldRange readFrom(StreamInput in) throws IOException { - if (in.getVersion().before(LONG_FIELD_RANGE_VERSION_INTRODUCED)) { - // conservative treatment for BWC - return UNKNOWN; - } - final byte type = in.readByte(); switch (type) { case WIRE_TYPE_UNKNOWN: @@ -111,16 +103,14 @@ public static ShardLongFieldRange readFrom(StreamInput in) throws IOException { @Override public void writeTo(StreamOutput out) throws IOException { - if (out.getVersion().onOrAfter(LONG_FIELD_RANGE_VERSION_INTRODUCED)) { - if (this == UNKNOWN) { - out.writeByte(WIRE_TYPE_UNKNOWN); - } else if (this == EMPTY) { - out.writeByte(WIRE_TYPE_EMPTY); - } else { - out.writeByte(WIRE_TYPE_OTHER); - out.writeZLong(min); - out.writeZLong(max); - } + if (this == UNKNOWN) { + out.writeByte(WIRE_TYPE_UNKNOWN); + } else if (this == EMPTY) { + out.writeByte(WIRE_TYPE_EMPTY); + } else { + out.writeByte(WIRE_TYPE_OTHER); + out.writeZLong(min); + out.writeZLong(max); } } diff --git a/server/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java b/server/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java index b5c30f54b54f..cd98f3ab6505 100644 --- a/server/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java @@ -532,8 +532,7 @@ public void testStartedShardEntrySerialization() throws Exception { assertThat(deserialized.allocationId, equalTo(allocationId)); assertThat(deserialized.primaryTerm, equalTo(primaryTerm)); assertThat(deserialized.message, equalTo(message)); - assertThat(deserialized.timestampMillisRange, version.onOrAfter(ShardLongFieldRange.LONG_FIELD_RANGE_VERSION_INTRODUCED) ? - equalTo(timestampMillisRange) : sameInstance(ShardLongFieldRange.UNKNOWN)); + assertThat(deserialized.timestampMillisRange, equalTo(timestampMillisRange)); } }