Remove LegacyESVersion.V_6_3_x constants (#1691)

This commit removes LegacyESVersion.V_6_3_x constants including all
pre-release versions and bug fixes.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
This commit is contained in:
Nick Knize 2021-12-17 17:24:50 -05:00 committed by GitHub
parent 4a82eb977d
commit 3f210dcfce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 52 additions and 209 deletions

View File

@ -215,15 +215,11 @@ public class Build {
// (Integ test zip still write OSS as distribution)
// See issue: https://github.com/opendistro-for-elasticsearch/search/issues/159
// todo change to V_1_3_0 after backporting
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0) && in.getVersion().before(Version.V_2_0_0)) {
if (in.getVersion().before(Version.V_2_0_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
type = Type.fromDisplayName(in.readString(), false);
} else {
type = Type.UNKNOWN;
}
String hash = in.readString();
String date = in.readString();
boolean snapshot = in.readBoolean();
@ -247,10 +243,9 @@ public class Build {
// 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
// todo change to V_1_3_0 after backporting
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0) && out.getVersion().before(Version.V_2_0_0)) {
if (out.getVersion().before(Version.V_2_0_0)) {
out.writeString("oss");
}
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
final Type buildType;
if (out.getVersion().before(LegacyESVersion.V_6_7_0) && build.type() == Type.DOCKER) {
buildType = Type.TAR;
@ -258,7 +253,6 @@ public class Build {
buildType = build.type();
}
out.writeString(buildType.displayName());
}
out.writeString(build.hash());
out.writeString(build.date());
out.writeBoolean(build.isSnapshot());

View File

@ -46,9 +46,6 @@ import java.lang.reflect.Field;
*/
public class LegacyESVersion extends Version {
public static final LegacyESVersion V_6_3_0 = new LegacyESVersion(6030099, org.apache.lucene.util.Version.LUCENE_7_3_1);
public static final LegacyESVersion V_6_3_1 = new LegacyESVersion(6030199, org.apache.lucene.util.Version.LUCENE_7_3_1);
public static final LegacyESVersion V_6_3_2 = new LegacyESVersion(6030299, org.apache.lucene.util.Version.LUCENE_7_3_1);
public static final LegacyESVersion V_6_4_0 = new LegacyESVersion(6040099, org.apache.lucene.util.Version.LUCENE_7_4_0);
public static final LegacyESVersion V_6_4_1 = new LegacyESVersion(6040199, org.apache.lucene.util.Version.LUCENE_7_4_0);
public static final LegacyESVersion V_6_4_2 = new LegacyESVersion(6040299, org.apache.lucene.util.Version.LUCENE_7_4_0);

View File

@ -34,7 +34,6 @@ package org.opensearch.action.admin.cluster.reroute;
import org.opensearch.LegacyESVersion;
import org.opensearch.action.support.master.AcknowledgedResponse;
import org.opensearch.cluster.ClusterModule;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.routing.allocation.RoutingExplanations;
import org.opensearch.common.io.stream.StreamInput;
@ -89,11 +88,7 @@ public class ClusterRerouteResponse extends AcknowledgedResponse implements ToXC
state.writeTo(out);
RoutingExplanations.writeTo(explanations, out);
} else {
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
state.writeTo(out);
} else {
ClusterModule.filterCustomsForPre63Clients(state).writeTo(out);
}
out.writeBoolean(acknowledged);
RoutingExplanations.writeTo(explanations, out);
}

View File

@ -34,7 +34,6 @@ package org.opensearch.action.admin.cluster.state;
import org.opensearch.LegacyESVersion;
import org.opensearch.action.ActionResponse;
import org.opensearch.cluster.ClusterModule;
import org.opensearch.cluster.ClusterName;
import org.opensearch.cluster.ClusterState;
import org.opensearch.cluster.node.DiscoveryNodes;
@ -105,11 +104,7 @@ public class ClusterStateResponse extends ActionResponse {
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_6_0)) {
out.writeOptionalWriteable(clusterState);
} else {
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
clusterState.writeTo(out);
} else {
ClusterModule.filterCustomsForPre63Clients(clusterState).writeTo(out);
}
}
if (out.getVersion().before(LegacyESVersion.V_7_0_0)) {
ByteSizeValue.ZERO.writeTo(out);

View File

@ -235,9 +235,7 @@ public class SearchRequest extends ActionRequest implements IndicesRequest.Repla
} else {
preFilterShardSize = in.readVInt();
}
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
allowPartialSearchResults = in.readOptionalBoolean();
}
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_7_0)) {
localClusterAlias = in.readOptionalString();
if (localClusterAlias != null) {
@ -280,9 +278,7 @@ public class SearchRequest extends ActionRequest implements IndicesRequest.Repla
} else {
out.writeVInt(preFilterShardSize == null ? DEFAULT_BATCHED_REDUCE_SIZE : preFilterShardSize);
}
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
out.writeOptionalBoolean(allowPartialSearchResults);
}
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_7_0)) {
out.writeOptionalString(localClusterAlias);
if (localClusterAlias != null) {

View File

@ -566,11 +566,7 @@ public class ShardStateAction {
primaryTerm = in.readVLong();
message = in.readString();
failure = in.readException();
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
markAsStale = in.readBoolean();
} else {
markAsStale = true;
}
}
public FailedShardEntry(
@ -605,10 +601,8 @@ public class ShardStateAction {
out.writeVLong(primaryTerm);
out.writeString(message);
out.writeException(failure);
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
out.writeBoolean(markAsStale);
}
}
@Override
public String toString() {
@ -825,19 +819,12 @@ public class ShardStateAction {
super(in);
shardId = new ShardId(in);
allocationId = in.readString();
if (in.getVersion().before(LegacyESVersion.V_6_3_0)) {
primaryTerm = in.readVLong();
assert primaryTerm == UNASSIGNED_PRIMARY_TERM : "shard is only started by itself: primary term [" + primaryTerm + "]";
} else if (in.getVersion().onOrAfter(LegacyESVersion.V_6_7_0)) {
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_7_0)) {
primaryTerm = in.readVLong();
} else {
primaryTerm = UNASSIGNED_PRIMARY_TERM;
}
this.message = in.readString();
if (in.getVersion().before(LegacyESVersion.V_6_3_0)) {
final Exception ex = in.readException();
assert ex == null : "started shard must not have failure [" + ex + "]";
}
}
public StartedShardEntry(final ShardId shardId, final String allocationId, final long primaryTerm, final String message) {
@ -852,15 +839,10 @@ public class ShardStateAction {
super.writeTo(out);
shardId.writeTo(out);
out.writeString(allocationId);
if (out.getVersion().before(LegacyESVersion.V_6_3_0)) {
out.writeVLong(0L);
} else if (out.getVersion().onOrAfter(LegacyESVersion.V_6_7_0)) {
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_7_0)) {
out.writeVLong(primaryTerm);
}
out.writeString(message);
if (out.getVersion().before(LegacyESVersion.V_6_3_0)) {
out.writeException(null);
}
}
@Override

View File

@ -32,7 +32,6 @@
package org.opensearch.index.flush;
import org.opensearch.LegacyESVersion;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
import org.opensearch.common.io.stream.Writeable;
@ -55,10 +54,8 @@ public class FlushStats implements Writeable, ToXContentFragment {
public FlushStats(StreamInput in) throws IOException {
total = in.readVLong();
totalTimeInMillis = in.readVLong();
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
periodic = in.readVLong();
}
}
public FlushStats(long total, long periodic, long totalTimeInMillis) {
this.total = total;
@ -135,8 +132,6 @@ public class FlushStats implements Writeable, ToXContentFragment {
public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(total);
out.writeVLong(totalTimeInMillis);
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
out.writeVLong(periodic);
}
}
}

View File

@ -693,16 +693,7 @@ public class ReplicationTracker extends AbstractIndexShardComponent implements L
this.localCheckpoint = in.readZLong();
this.globalCheckpoint = in.readZLong();
this.inSync = in.readBoolean();
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
this.tracked = in.readBoolean();
} else {
// Every in-sync shard copy is also tracked (see invariant). This was the case even in earlier OpenSearch versions.
// Non in-sync shard copies might be tracked or not. As this information here is only serialized during relocation hand-off,
// after which replica recoveries cannot complete anymore (i.e. they cannot move from in-sync == false to in-sync == true),
// we can treat non in-sync replica shard copies as untracked. They will go through a fresh recovery against the new
// primary and will become tracked again under this primary before they are marked as in-sync.
this.tracked = inSync;
}
}
@Override
@ -710,10 +701,8 @@ public class ReplicationTracker extends AbstractIndexShardComponent implements L
out.writeZLong(localCheckpoint);
out.writeZLong(globalCheckpoint);
out.writeBoolean(inSync);
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
out.writeBoolean(tracked);
}
}
/**
* Returns a full copy of this object

View File

@ -31,7 +31,6 @@
package org.opensearch.index.translog;
import org.opensearch.LegacyESVersion;
import org.opensearch.common.Strings;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.common.io.stream.StreamOutput;
@ -57,10 +56,8 @@ public class TranslogStats implements Writeable, ToXContentFragment {
translogSizeInBytes = in.readVLong();
uncommittedOperations = in.readVInt();
uncommittedSizeInBytes = in.readVLong();
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
earliestLastModifiedAge = in.readVLong();
}
}
public TranslogStats(
int numberOfOperations,
@ -152,8 +149,6 @@ public class TranslogStats implements Writeable, ToXContentFragment {
out.writeVLong(translogSizeInBytes);
out.writeVInt(uncommittedOperations);
out.writeVLong(uncommittedSizeInBytes);
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
out.writeVLong(earliestLastModifiedAge);
}
}
}

View File

@ -36,7 +36,6 @@ import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.message.ParameterizedMessage;
import org.opensearch.LegacyESVersion;
import org.opensearch.OpenSearchException;
import org.opensearch.Version;
import org.opensearch.action.ActionListener;
import org.opensearch.action.StepListener;
import org.opensearch.action.admin.indices.flush.FlushRequest;
@ -700,10 +699,8 @@ public class SyncedFlushService implements IndexEventListener {
super(in);
commitId = new Engine.CommitId(in);
numDocs = in.readInt();
if (includeExistingSyncId(in.getVersion())) {
existingSyncId = in.readOptionalString();
}
}
PreSyncedFlushResponse(Engine.CommitId commitId, int numDocs, String existingSyncId) {
this.commitId = commitId;
@ -711,19 +708,13 @@ public class SyncedFlushService implements IndexEventListener {
this.existingSyncId = existingSyncId;
}
boolean includeExistingSyncId(Version version) {
return version.onOrAfter(LegacyESVersion.V_6_3_0);
}
@Override
public void writeTo(StreamOutput out) throws IOException {
commitId.writeTo(out);
out.writeInt(numDocs);
if (includeExistingSyncId(out.getVersion())) {
out.writeOptionalString(existingSyncId);
}
}
}
public static final class ShardSyncedFlushRequest extends TransportRequest {

View File

@ -32,7 +32,6 @@
package org.opensearch.persistent;
import org.opensearch.LegacyESVersion;
import org.opensearch.ResourceAlreadyExistsException;
import org.opensearch.ResourceNotFoundException;
import org.opensearch.Version;
@ -382,11 +381,7 @@ public final class PersistentTasksCustomMetadata extends AbstractNamedDiffable<M
id = in.readString();
allocationId = in.readLong();
taskName = in.readString();
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
params = (P) in.readNamedWriteable(PersistentTaskParams.class);
} else {
params = (P) in.readOptionalNamedWriteable(PersistentTaskParams.class);
}
state = in.readOptionalNamedWriteable(PersistentTaskState.class);
assignment = new Assignment(in.readOptionalString(), in.readString());
allocationIdOnLastStatusUpdate = in.readOptionalLong();
@ -397,11 +392,7 @@ public final class PersistentTasksCustomMetadata extends AbstractNamedDiffable<M
out.writeString(id);
out.writeLong(allocationId);
out.writeString(taskName);
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
out.writeNamedWriteable(params);
} else {
out.writeOptionalNamedWriteable(params);
}
out.writeOptionalNamedWriteable(state);
out.writeOptionalString(assignment.executorNode);
out.writeString(assignment.explanation);

View File

@ -31,7 +31,6 @@
package org.opensearch.persistent;
import org.opensearch.LegacyESVersion;
import org.opensearch.action.ActionListener;
import org.opensearch.action.ActionRequestValidationException;
import org.opensearch.action.ActionType;
@ -83,11 +82,7 @@ public class StartPersistentTaskAction extends ActionType<PersistentTaskResponse
super(in);
taskId = in.readString();
taskName = in.readString();
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
params = in.readNamedWriteable(PersistentTaskParams.class);
} else {
params = in.readOptionalNamedWriteable(PersistentTaskParams.class);
}
}
public Request(String taskId, String taskName, PersistentTaskParams params) {
@ -101,11 +96,7 @@ public class StartPersistentTaskAction extends ActionType<PersistentTaskResponse
super.writeTo(out);
out.writeString(taskId);
out.writeString(taskName);
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
out.writeNamedWriteable(params);
} else {
out.writeOptionalNamedWriteable(params);
}
}
@Override

View File

@ -32,7 +32,6 @@
package org.opensearch.plugins;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.bootstrap.JarHell;
import org.opensearch.common.Strings;
@ -153,15 +152,8 @@ public class PluginInfo implements Writeable, ToXContentObject {
this.name = in.readString();
this.description = in.readString();
this.version = in.readString();
if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
opensearchVersion = Version.readVersion(in);
javaVersion = in.readString();
} else {
// the plugin must have the version of whichever node we are talking to, since this is enforced on startup
opensearchVersion = in.getVersion();
// this might not be true, but it is not important, we just need something here for bwc that is a valid java version string
javaVersion = "1.8";
}
this.opensearchVersion = Version.readVersion(in);
this.javaVersion = in.readString();
this.classname = in.readString();
if (in.getVersion().onOrAfter(Version.V_1_1_0)) {
customFolderName = in.readString();
@ -170,13 +162,6 @@ public class PluginInfo implements Writeable, ToXContentObject {
}
extendedPlugins = in.readStringList();
hasNativeController = in.readBoolean();
if (in.getVersion().onOrAfter(LegacyESVersion.fromId(6000027)) && in.getVersion().before(LegacyESVersion.V_6_3_0)) {
/*
* Legacy versions in [6.0.0-beta2, 6.3.0) allowed plugins to specify that they require the keystore and this was
* serialized into the plugin info. Therefore, we have to read and ignore this value from the stream.
*/
in.readBoolean();
}
}
@Override
@ -184,10 +169,8 @@ public class PluginInfo implements Writeable, ToXContentObject {
out.writeString(name);
out.writeString(description);
out.writeString(version);
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
Version.writeVersion(opensearchVersion, out);
out.writeString(javaVersion);
}
out.writeString(classname);
if (out.getVersion().onOrAfter(Version.V_1_1_0)) {
if (customFolderName != null) {
@ -198,13 +181,6 @@ public class PluginInfo implements Writeable, ToXContentObject {
}
out.writeStringCollection(extendedPlugins);
out.writeBoolean(hasNativeController);
if (out.getVersion().before(LegacyESVersion.V_6_3_0)) {
/*
* Elasticsearch versions in [6.0.0-beta2, 6.3.0) allowed plugins to specify that they require the keystore and this was
* serialized into the plugin info. Therefore, we have to write out a value for this boolean.
*/
out.writeBoolean(false);
}
}
/**
@ -295,10 +271,6 @@ public class PluginInfo implements Writeable, ToXContentObject {
}
}
if (opensearchVersion.before(LegacyESVersion.V_6_3_0) && opensearchVersion.onOrAfter(LegacyESVersion.fromId(6000027))) {
propsMap.remove("requires.keystore");
}
if (propsMap.isEmpty() == false) {
throw new IllegalArgumentException("Unknown properties in plugin descriptor: " + propsMap.keySet());
}

View File

@ -117,6 +117,7 @@ public class InternalComposite extends InternalMultiBucketAggregation<InternalCo
if (afterKey != null) {
afterKey.writeTo(out);
}
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_6_0)) {
out.writeBoolean(earlyTerminated);
}

View File

@ -252,8 +252,6 @@ public class ShardSearchRequest extends TransportRequest implements IndicesReque
clusterAlias = in.readOptionalString();
if (in.getVersion().onOrAfter(LegacyESVersion.V_7_0_0)) {
allowPartialSearchResults = in.readBoolean();
} else if (in.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
allowPartialSearchResults = in.readOptionalBoolean();
} else {
allowPartialSearchResults = false;
}
@ -335,8 +333,6 @@ public class ShardSearchRequest extends TransportRequest implements IndicesReque
out.writeOptionalString(clusterAlias);
if (out.getVersion().onOrAfter(LegacyESVersion.V_7_0_0)) {
out.writeBoolean(allowPartialSearchResults);
} else if (out.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
out.writeOptionalBoolean(allowPartialSearchResults);
}
if (asKey == false) {
if (out.getVersion().onOrAfter(LegacyESVersion.V_6_4_0)) {

View File

@ -117,23 +117,14 @@ public class SliceBuilder implements Writeable, ToXContentObject {
}
public SliceBuilder(StreamInput in) throws IOException {
String field = in.readString();
if ("_uid".equals(field) && in.getVersion().before(LegacyESVersion.V_6_3_0)) {
// This is safe because _id and _uid are handled the same way in #toFilter
field = IdFieldMapper.NAME;
}
this.field = field;
this.field = in.readString();
this.id = in.readVInt();
this.max = in.readVInt();
}
@Override
public void writeTo(StreamOutput out) throws IOException {
if (IdFieldMapper.NAME.equals(field) && out.getVersion().before(LegacyESVersion.V_6_3_0)) {
out.writeString("_uid");
} else {
out.writeString(field);
}
out.writeVInt(id);
out.writeVInt(max);
}

View File

@ -32,7 +32,6 @@
package org.opensearch.transport;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.collect.Tuple;
import org.opensearch.common.io.stream.StreamInput;
@ -121,16 +120,12 @@ public class Header {
this.headers = ThreadContext.readHeadersFromStream(input);
if (isRequest()) {
if (version.onOrAfter(LegacyESVersion.V_6_3_0)) {
final String[] featuresFound = input.readStringArray();
if (featuresFound.length == 0) {
features = Collections.emptySet();
} else {
features = Collections.unmodifiableSet(new TreeSet<>(Arrays.asList(featuresFound)));
}
} else {
features = Collections.emptySet();
}
this.actionName = input.readString();
} else {
this.actionName = RESPONSE_NAME;

View File

@ -31,7 +31,6 @@
package org.opensearch.transport;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.bytes.BytesArray;
import org.opensearch.common.bytes.BytesReference;
@ -136,9 +135,7 @@ abstract class OutboundMessage extends NetworkMessage {
@Override
protected void writeVariableHeader(StreamOutput stream) throws IOException {
super.writeVariableHeader(stream);
if (version.onOrAfter(LegacyESVersion.V_6_3_0)) {
stream.writeStringArray(features);
}
stream.writeString(action);
}

View File

@ -33,7 +33,6 @@ package org.opensearch.transport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.common.bytes.BytesReference;
import org.opensearch.common.compress.CompressorFactory;
@ -120,10 +119,8 @@ public final class TransportLogger {
ThreadContext.readHeadersFromStream(streamInput);
if (isRequest) {
if (streamInput.getVersion().onOrAfter(LegacyESVersion.V_6_3_0)) {
// discard features
streamInput.readStringArray();
}
sb.append(", action: ").append(streamInput.readString());
}
sb.append(']');

View File

@ -301,9 +301,7 @@ public class BuildTests extends OpenSearchTestCase {
final List<Version> versions = Version.getDeclaredVersions(LegacyESVersion.class);
final Version post63Pre67Version = randomFrom(
versions.stream()
.filter(v -> v.onOrAfter(LegacyESVersion.V_6_3_0) && v.before(LegacyESVersion.V_6_7_0))
.collect(Collectors.toList())
versions.stream().filter(v -> v.before(LegacyESVersion.V_6_7_0)).collect(Collectors.toList())
);
final Version post67Pre70Version = randomFrom(
versions.stream()

View File

@ -64,8 +64,8 @@ public class LegacyESVersionTests extends OpenSearchTestCase {
// compare opensearch version to LegacyESVersion
assertThat(Version.V_1_0_0.compareMajor(LegacyESVersion.V_7_0_0), is(0));
assertThat(Version.V_1_0_0.compareMajor(LegacyESVersion.V_6_3_0), is(1));
assertThat(LegacyESVersion.V_6_3_0.compareMajor(Version.V_1_0_0), is(-1));
assertThat(Version.V_1_0_0.compareMajor(LegacyESVersion.fromString("6.3.0")), is(1));
assertThat(LegacyESVersion.fromString("6.3.0").compareMajor(Version.V_1_0_0), is(-1));
}
public void testMin() {
@ -143,7 +143,7 @@ public class LegacyESVersionTests extends OpenSearchTestCase {
Version major56x = LegacyESVersion.fromString("5.6.0");
assertThat(LegacyESVersion.V_6_5_0.minimumCompatibilityVersion(), equalTo(major56x));
assertThat(LegacyESVersion.V_6_3_1.minimumCompatibilityVersion(), equalTo(major56x));
assertThat(LegacyESVersion.fromString("6.3.1").minimumCompatibilityVersion(), equalTo(major56x));
// from 7.0 on we are supporting the latest minor of the previous major... this might fail once we add a new version ie. 5.x is
// released since we need to bump the supported minor in Version#minimumCompatibilityVersion()

View File

@ -40,6 +40,7 @@ import org.opensearch.common.Strings;
import org.opensearch.common.io.stream.BytesStreamOutput;
import org.opensearch.common.io.stream.StreamInput;
import org.opensearch.test.OpenSearchTestCase;
import org.opensearch.test.VersionUtils;
import java.util.Locale;
@ -77,7 +78,7 @@ public class ClusterHealthRequestTests extends OpenSearchTestCase {
for (int runs = 0; runs < randomIntBetween(5, 20); runs++) {
// Generate a random cluster health request in version < 7.2.0 and serializes it
final BytesStreamOutput out = new BytesStreamOutput();
out.setVersion(randomVersionBetween(random(), LegacyESVersion.V_6_3_0, getPreviousVersion(LegacyESVersion.V_7_2_0)));
out.setVersion(randomVersionBetween(random(), VersionUtils.getFirstVersion(), getPreviousVersion(LegacyESVersion.V_7_2_0)));
final ClusterHealthRequest expected = randomRequest();
{
@ -132,7 +133,7 @@ public class ClusterHealthRequestTests extends OpenSearchTestCase {
// Serialize to node in version < 7.2.0
final BytesStreamOutput out = new BytesStreamOutput();
out.setVersion(randomVersionBetween(random(), LegacyESVersion.V_6_3_0, getPreviousVersion(LegacyESVersion.V_7_2_0)));
out.setVersion(randomVersionBetween(random(), VersionUtils.getFirstVersion(), getPreviousVersion(LegacyESVersion.V_7_2_0)));
expected.writeTo(out);
// Deserialize and check the cluster health request

View File

@ -42,7 +42,6 @@ import org.apache.lucene.search.MatchNoDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.store.ByteBuffersDirectory;
import org.apache.lucene.store.Directory;
import org.opensearch.LegacyESVersion;
import org.opensearch.Version;
import org.opensearch.action.OriginalIndices;
import org.opensearch.action.search.SearchRequest;
@ -361,21 +360,6 @@ public class SliceBuilderTests extends OpenSearchTestCase {
}
}
public void testToFilterDeprecationMessage() throws IOException {
Directory dir = new ByteBuffersDirectory();
try (IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(new MockAnalyzer(random())))) {
writer.commit();
}
try (IndexReader reader = DirectoryReader.open(dir)) {
QueryShardContext context = createShardContext(LegacyESVersion.V_6_3_0, reader, "_uid", null, 1, 0);
SliceBuilder builder = new SliceBuilder("_uid", 5, 10);
Query query = builder.toFilter(null, createRequest(0), context, Version.CURRENT);
assertThat(query, instanceOf(TermsSliceQuery.class));
assertThat(builder.toFilter(null, createRequest(0), context, Version.CURRENT), equalTo(query));
assertWarnings("Computing slices on the [_uid] field is deprecated for 6.x indices, use [_id] instead");
}
}
public void testToFilterWithRouting() throws IOException {
Directory dir = new ByteBuffersDirectory();
try (IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig(new MockAnalyzer(random())))) {

View File

@ -136,7 +136,7 @@ public class SetupSectionTests extends AbstractClientYamlTestFragmentParserTestC
assertThat(setupSection.getSkipSection().isEmpty(), equalTo(false));
assertThat(setupSection.getSkipSection(), notNullValue());
assertThat(setupSection.getSkipSection().getLowerVersion(), equalTo(LegacyESVersion.fromString("6.0.0")));
assertThat(setupSection.getSkipSection().getUpperVersion(), equalTo(LegacyESVersion.V_6_3_0));
assertThat(setupSection.getSkipSection().getUpperVersion(), equalTo(LegacyESVersion.fromString("6.3.0")));
assertThat(setupSection.getSkipSection().getReason(), equalTo("Update doesn't return metadata fields, waiting for #3259"));
assertThat(setupSection.getExecutableSections().size(), equalTo(2));
assertThat(setupSection.getExecutableSections().get(0), instanceOf(DoSection.class));