Fix Version based BWC and set correct minCompatVersion (#24732)

Approaching the release of 6.0 we need to sort out the usage of
`Version#minimumCompatibilityVersion` which was still set to 5.0.0.
Now this change moves it to the latest released version of 5.x (5.4 at this point)
to ensure we are compatible with the latest minor of the previous major. This change
also removes all the `_UNRELEASED` from the versions that where released and drops versions
that were never released and are not expected to be released (bugfixes in minors that are not
the latest in the previous major).
This commit is contained in:
Simon Willnauer 2017-05-17 17:27:09 +02:00 committed by GitHub
parent 0189a65e6b
commit 2ccc223ff7
86 changed files with 221 additions and 247 deletions

View File

@ -133,7 +133,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
super(in.readOptionalString(), in.readException()); super(in.readOptionalString(), in.readException());
readStackTrace(this, in); readStackTrace(this, in);
headers.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString)); headers.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString));
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
metadata.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString)); metadata.putAll(in.readMapOfLists(StreamInput::readString, StreamInput::readString));
} else { } else {
for (Iterator<Map.Entry<String, List<String>>> iterator = headers.entrySet().iterator(); iterator.hasNext(); ) { for (Iterator<Map.Entry<String, List<String>>> iterator = headers.entrySet().iterator(); iterator.hasNext(); ) {
@ -284,7 +284,7 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
out.writeOptionalString(this.getMessage()); out.writeOptionalString(this.getMessage());
out.writeException(this.getCause()); out.writeException(this.getCause());
writeStackTraces(this, out); writeStackTraces(this, out);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
out.writeMapOfLists(headers, StreamOutput::writeString, StreamOutput::writeString); out.writeMapOfLists(headers, StreamOutput::writeString, StreamOutput::writeString);
out.writeMapOfLists(metadata, StreamOutput::writeString, StreamOutput::writeString); out.writeMapOfLists(metadata, StreamOutput::writeString, StreamOutput::writeString);
} else { } else {
@ -985,11 +985,11 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
STATUS_EXCEPTION(org.elasticsearch.ElasticsearchStatusException.class, org.elasticsearch.ElasticsearchStatusException::new, 145, STATUS_EXCEPTION(org.elasticsearch.ElasticsearchStatusException.class, org.elasticsearch.ElasticsearchStatusException::new, 145,
UNKNOWN_VERSION_ADDED), UNKNOWN_VERSION_ADDED),
TASK_CANCELLED_EXCEPTION(org.elasticsearch.tasks.TaskCancelledException.class, TASK_CANCELLED_EXCEPTION(org.elasticsearch.tasks.TaskCancelledException.class,
org.elasticsearch.tasks.TaskCancelledException::new, 146, Version.V_5_1_1_UNRELEASED), org.elasticsearch.tasks.TaskCancelledException::new, 146, Version.V_5_1_1),
SHARD_LOCK_OBTAIN_FAILED_EXCEPTION(org.elasticsearch.env.ShardLockObtainFailedException.class, SHARD_LOCK_OBTAIN_FAILED_EXCEPTION(org.elasticsearch.env.ShardLockObtainFailedException.class,
org.elasticsearch.env.ShardLockObtainFailedException::new, 147, Version.V_5_0_2), org.elasticsearch.env.ShardLockObtainFailedException::new, 147, Version.V_5_0_2),
UNKNOWN_NAMED_OBJECT_EXCEPTION(org.elasticsearch.common.xcontent.NamedXContentRegistry.UnknownNamedObjectException.class, UNKNOWN_NAMED_OBJECT_EXCEPTION(org.elasticsearch.common.xcontent.NamedXContentRegistry.UnknownNamedObjectException.class,
org.elasticsearch.common.xcontent.NamedXContentRegistry.UnknownNamedObjectException::new, 148, Version.V_5_2_0_UNRELEASED); org.elasticsearch.common.xcontent.NamedXContentRegistry.UnknownNamedObjectException::new, 148, Version.V_5_2_0);
final Class<? extends ElasticsearchException> exceptionClass; final Class<? extends ElasticsearchException> exceptionClass;
final CheckedFunction<StreamInput, ? extends ElasticsearchException, IOException> constructor; final CheckedFunction<StreamInput, ? extends ElasticsearchException, IOException> constructor;

View File

@ -55,33 +55,25 @@ public class Version implements Comparable<Version> {
public static final Version V_5_0_1 = new Version(V_5_0_1_ID, org.apache.lucene.util.Version.LUCENE_6_2_1); public static final Version V_5_0_1 = new Version(V_5_0_1_ID, org.apache.lucene.util.Version.LUCENE_6_2_1);
public static final int V_5_0_2_ID = 5000299; public static final int V_5_0_2_ID = 5000299;
public static final Version V_5_0_2 = new Version(V_5_0_2_ID, org.apache.lucene.util.Version.LUCENE_6_2_1); public static final Version V_5_0_2 = new Version(V_5_0_2_ID, org.apache.lucene.util.Version.LUCENE_6_2_1);
public static final int V_5_0_3_ID_UNRELEASED = 5000399;
public static final Version V_5_0_3_UNRELEASED = new Version(V_5_0_3_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_3_0);
// no version constant for 5.1.0 due to inadvertent release // no version constant for 5.1.0 due to inadvertent release
public static final int V_5_1_1_ID_UNRELEASED = 5010199; public static final int V_5_1_1_ID = 5010199;
public static final Version V_5_1_1_UNRELEASED = new Version(V_5_1_1_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_3_0); public static final Version V_5_1_1 = new Version(V_5_1_1_ID, org.apache.lucene.util.Version.LUCENE_6_3_0);
public static final int V_5_1_2_ID_UNRELEASED = 5010299; public static final int V_5_1_2_ID = 5010299;
public static final Version V_5_1_2_UNRELEASED = new Version(V_5_1_2_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_3_0); public static final Version V_5_1_2 = new Version(V_5_1_2_ID, org.apache.lucene.util.Version.LUCENE_6_3_0);
public static final int V_5_1_3_ID_UNRELEASED = 5010399; public static final int V_5_2_0_ID = 5020099;
public static final Version V_5_1_3_UNRELEASED = new Version(V_5_1_3_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_3_0); public static final Version V_5_2_0 = new Version(V_5_2_0_ID, org.apache.lucene.util.Version.LUCENE_6_4_0);
public static final int V_5_2_0_ID_UNRELEASED = 5020099; public static final int V_5_2_1_ID = 5020199;
public static final Version V_5_2_0_UNRELEASED = new Version(V_5_2_0_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_4_0); public static final Version V_5_2_1 = new Version(V_5_2_1_ID, org.apache.lucene.util.Version.LUCENE_6_4_1);
public static final int V_5_2_1_ID_UNRELEASED = 5020199; public static final int V_5_2_2_ID = 5020299;
public static final Version V_5_2_1_UNRELEASED = new Version(V_5_2_1_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_4_1); public static final Version V_5_2_2 = new Version(V_5_2_2_ID, org.apache.lucene.util.Version.LUCENE_6_4_1);
public static final int V_5_2_2_ID_UNRELEASED = 5020299; public static final int V_5_3_0_ID = 5030099;
public static final Version V_5_2_2_UNRELEASED = new Version(V_5_2_2_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_4_1); public static final Version V_5_3_0 = new Version(V_5_3_0_ID, org.apache.lucene.util.Version.LUCENE_6_4_1);
public static final int V_5_2_3_ID_UNRELEASED = 5020399; public static final int V_5_3_1_ID = 5030199;
public static final Version V_5_2_3_UNRELEASED = new Version(V_5_2_3_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_4_1); public static final Version V_5_3_1 = new Version(V_5_3_1_ID, org.apache.lucene.util.Version.LUCENE_6_4_2);
public static final int V_5_3_0_ID_UNRELEASED = 5030099; public static final int V_5_3_2_ID = 5030299;
public static final Version V_5_3_0_UNRELEASED = new Version(V_5_3_0_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_4_1); public static final Version V_5_3_2 = new Version(V_5_3_2_ID, org.apache.lucene.util.Version.LUCENE_6_4_2);
public static final int V_5_3_1_ID_UNRELEASED = 5030199; public static final int V_5_4_0_ID = 5040099;
public static final Version V_5_3_1_UNRELEASED = new Version(V_5_3_1_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_4_2); public static final Version V_5_4_0 = new Version(V_5_4_0_ID, org.apache.lucene.util.Version.LUCENE_6_5_0);
public static final int V_5_3_2_ID_UNRELEASED = 5030299;
public static final Version V_5_3_2_UNRELEASED = new Version(V_5_3_2_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_4_2);
public static final int V_5_4_0_ID_UNRELEASED = 5040099;
public static final Version V_5_4_0_UNRELEASED = new Version(V_5_4_0_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_5_0);
public static final int V_5_4_1_ID_UNRELEASED = 5040199;
public static final Version V_5_4_1_UNRELEASED = new Version(V_5_4_1_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_5_1);
public static final int V_5_5_0_ID_UNRELEASED = 5050099; public static final int V_5_5_0_ID_UNRELEASED = 5050099;
public static final Version V_5_5_0_UNRELEASED = new Version(V_5_5_0_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_5_0); public static final Version V_5_5_0_UNRELEASED = new Version(V_5_5_0_ID_UNRELEASED, org.apache.lucene.util.Version.LUCENE_6_5_0);
public static final int V_6_0_0_alpha1_ID_UNRELEASED = 6000001; public static final int V_6_0_0_alpha1_ID_UNRELEASED = 6000001;
@ -111,32 +103,24 @@ public class Version implements Comparable<Version> {
return V_6_0_0_alpha1_UNRELEASED; return V_6_0_0_alpha1_UNRELEASED;
case V_5_5_0_ID_UNRELEASED: case V_5_5_0_ID_UNRELEASED:
return V_5_5_0_UNRELEASED; return V_5_5_0_UNRELEASED;
case V_5_4_1_ID_UNRELEASED: case V_5_4_0_ID:
return V_5_4_1_UNRELEASED; return V_5_4_0;
case V_5_4_0_ID_UNRELEASED: case V_5_3_2_ID:
return V_5_4_0_UNRELEASED; return V_5_3_2;
case V_5_3_2_ID_UNRELEASED: case V_5_3_1_ID:
return V_5_3_2_UNRELEASED; return V_5_3_1;
case V_5_3_1_ID_UNRELEASED: case V_5_3_0_ID:
return V_5_3_1_UNRELEASED; return V_5_3_0;
case V_5_3_0_ID_UNRELEASED: case V_5_2_2_ID:
return V_5_3_0_UNRELEASED; return V_5_2_2;
case V_5_2_3_ID_UNRELEASED: case V_5_2_1_ID:
return V_5_2_3_UNRELEASED; return V_5_2_1;
case V_5_2_2_ID_UNRELEASED: case V_5_2_0_ID:
return V_5_2_2_UNRELEASED; return V_5_2_0;
case V_5_2_1_ID_UNRELEASED: case V_5_1_2_ID:
return V_5_2_1_UNRELEASED; return V_5_1_2;
case V_5_2_0_ID_UNRELEASED: case V_5_1_1_ID:
return V_5_2_0_UNRELEASED; return V_5_1_1;
case V_5_1_3_ID_UNRELEASED:
return V_5_1_3_UNRELEASED;
case V_5_1_2_ID_UNRELEASED:
return V_5_1_2_UNRELEASED;
case V_5_1_1_ID_UNRELEASED:
return V_5_1_1_UNRELEASED;
case V_5_0_3_ID_UNRELEASED:
return V_5_0_3_UNRELEASED;
case V_5_0_2_ID: case V_5_0_2_ID:
return V_5_0_2; return V_5_0_2;
case V_5_0_1_ID: case V_5_0_1_ID:
@ -296,7 +280,7 @@ public class Version implements Comparable<Version> {
final int bwcMinor; final int bwcMinor;
if (this.onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) { if (this.onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) {
bwcMajor = major - 1; bwcMajor = major - 1;
bwcMinor = 0; // TODO we have to move this to the latest released minor of the last major but for now we just keep bwcMinor = 4;
} else { } else {
bwcMajor = major; bwcMajor = major;
bwcMinor = 0; bwcMinor = 0;
@ -306,7 +290,8 @@ public class Version implements Comparable<Version> {
/** /**
* Returns the minimum created index version that this version supports. Indices created with lower versions * Returns the minimum created index version that this version supports. Indices created with lower versions
* can't be used with this version. * can't be used with this version. This should also be used for file based serialization backwards compatibility ie. on serialization
* code that is used to read / write file formats like transaction logs, cluster state, and index metadata.
*/ */
public Version minimumIndexCompatibilityVersion() { public Version minimumIndexCompatibilityVersion() {
final int bwcMajor; final int bwcMajor;

View File

@ -249,8 +249,8 @@ public class ClusterAllocationExplainRequest extends MasterNodeRequest<ClusterAl
} }
private void checkVersion(Version version) { private void checkVersion(Version version) {
if (version.before(Version.V_5_2_0_UNRELEASED)) { if (version.before(Version.V_5_2_0)) {
throw new IllegalArgumentException("cannot explain shards in a mixed-cluster with pre-" + Version.V_5_2_0_UNRELEASED + throw new IllegalArgumentException("cannot explain shards in a mixed-cluster with pre-" + Version.V_5_2_0 +
" nodes, node version [" + version + "]"); " nodes, node version [" + version + "]");
} }
} }

View File

@ -134,7 +134,7 @@ public class ClusterSearchShardsRequest extends MasterNodeReadRequest<ClusterSea
routing = in.readOptionalString(); routing = in.readOptionalString();
preference = in.readOptionalString(); preference = in.readOptionalString();
if (in.getVersion().onOrBefore(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrBefore(Version.V_5_1_1)) {
//types //types
in.readStringArray(); in.readStringArray();
} }
@ -153,7 +153,7 @@ public class ClusterSearchShardsRequest extends MasterNodeReadRequest<ClusterSea
out.writeOptionalString(routing); out.writeOptionalString(routing);
out.writeOptionalString(preference); out.writeOptionalString(preference);
if (out.getVersion().onOrBefore(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrBefore(Version.V_5_1_1)) {
//types //types
out.writeStringArray(Strings.EMPTY_ARRAY); out.writeStringArray(Strings.EMPTY_ARRAY);
} }

View File

@ -73,7 +73,7 @@ public class ClusterSearchShardsResponse extends ActionResponse implements ToXCo
for (int i = 0; i < nodes.length; i++) { for (int i = 0; i < nodes.length; i++) {
nodes[i] = new DiscoveryNode(in); nodes[i] = new DiscoveryNode(in);
} }
if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
int size = in.readVInt(); int size = in.readVInt();
indicesAndFilters = new HashMap<>(); indicesAndFilters = new HashMap<>();
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
@ -95,7 +95,7 @@ public class ClusterSearchShardsResponse extends ActionResponse implements ToXCo
for (DiscoveryNode node : nodes) { for (DiscoveryNode node : nodes) {
node.writeTo(out); node.writeTo(out);
} }
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeVInt(indicesAndFilters.size()); out.writeVInt(indicesAndFilters.size());
for (Map.Entry<String, AliasFilter> entry : indicesAndFilters.entrySet()) { for (Map.Entry<String, AliasFilter> entry : indicesAndFilters.entrySet()) {
out.writeString(entry.getKey()); out.writeString(entry.getKey());

View File

@ -59,7 +59,7 @@ public class GetStoredScriptResponse extends ActionResponse implements ToXConten
super.readFrom(in); super.readFrom(in);
if (in.readBoolean()) { if (in.readBoolean()) {
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
source = new StoredScriptSource(in); source = new StoredScriptSource(in);
} else { } else {
source = new StoredScriptSource(in.readString()); source = new StoredScriptSource(in.readString());
@ -78,7 +78,7 @@ public class GetStoredScriptResponse extends ActionResponse implements ToXConten
} else { } else {
out.writeBoolean(true); out.writeBoolean(true);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
source.writeTo(out); source.writeTo(out);
} else { } else {
out.writeString(source.getCode()); out.writeString(source.getCode());

View File

@ -123,7 +123,7 @@ public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptR
id = in.readOptionalString(); id = in.readOptionalString();
content = in.readBytesReference(); content = in.readBytesReference();
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType = XContentType.readFrom(in); xContentType = XContentType.readFrom(in);
} else { } else {
xContentType = XContentFactory.xContentType(content); xContentType = XContentFactory.xContentType(content);
@ -137,7 +137,7 @@ public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptR
out.writeString(lang == null ? "" : lang); out.writeString(lang == null ? "" : lang);
out.writeOptionalString(id); out.writeOptionalString(id);
out.writeBytesReference(content); out.writeBytesReference(content);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType.writeTo(out); xContentType.writeTo(out);
} }
} }

View File

@ -117,7 +117,7 @@ public class AnalyzeResponse extends ActionResponse implements Iterable<AnalyzeR
startOffset = in.readInt(); startOffset = in.readInt();
endOffset = in.readInt(); endOffset = in.readInt();
position = in.readVInt(); position = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_2_0)) {
Integer len = in.readOptionalVInt(); Integer len = in.readOptionalVInt();
if (len != null) { if (len != null) {
positionLength = len; positionLength = len;
@ -135,7 +135,7 @@ public class AnalyzeResponse extends ActionResponse implements Iterable<AnalyzeR
out.writeInt(startOffset); out.writeInt(startOffset);
out.writeInt(endOffset); out.writeInt(endOffset);
out.writeVInt(position); out.writeVInt(position);
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_2_0)) {
out.writeOptionalVInt(positionLength > 1 ? positionLength : null); out.writeOptionalVInt(positionLength > 1 ? positionLength : null);
} }
out.writeOptionalString(type); out.writeOptionalString(type);

View File

@ -76,7 +76,7 @@ public class QueryExplanation implements Streamable {
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
index = in.readString(); index = in.readString();
if (in.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_4_0)) {
shard = in.readInt(); shard = in.readInt();
} else { } else {
shard = RANDOM_SHARD; shard = RANDOM_SHARD;
@ -89,7 +89,7 @@ public class QueryExplanation implements Streamable {
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
out.writeString(index); out.writeString(index);
if (out.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_4_0)) {
out.writeInt(shard); out.writeInt(shard);
} }
out.writeBoolean(valid); out.writeBoolean(valid);

View File

@ -154,7 +154,7 @@ public class ValidateQueryRequest extends BroadcastRequest<ValidateQueryRequest>
} }
explain = in.readBoolean(); explain = in.readBoolean();
rewrite = in.readBoolean(); rewrite = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_4_0)) {
allShards = in.readBoolean(); allShards = in.readBoolean();
} }
} }
@ -169,7 +169,7 @@ public class ValidateQueryRequest extends BroadcastRequest<ValidateQueryRequest>
} }
out.writeBoolean(explain); out.writeBoolean(explain);
out.writeBoolean(rewrite); out.writeBoolean(rewrite);
if (out.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_4_0)) {
out.writeBoolean(allShards); out.writeBoolean(allShards);
} }
} }

View File

@ -37,7 +37,6 @@ import org.elasticsearch.common.xcontent.StatusToXContentObject;
import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.seqno.SequenceNumbers;
import org.elasticsearch.index.seqno.SequenceNumbersService; import org.elasticsearch.index.seqno.SequenceNumbersService;
import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.RestStatus;
@ -421,7 +420,7 @@ public class BulkItemResponse implements Streamable, StatusToXContentObject {
@Override @Override
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
id = in.readVInt(); id = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
opType = OpType.fromId(in.readByte()); opType = OpType.fromId(in.readByte());
} else { } else {
opType = OpType.fromString(in.readString()); opType = OpType.fromString(in.readString());
@ -448,7 +447,7 @@ public class BulkItemResponse implements Streamable, StatusToXContentObject {
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(id); out.writeVInt(id);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
out.writeByte(opType.getId()); out.writeByte(opType.getId());
} else { } else {
out.writeString(opType.getLowercase()); out.writeString(opType.getLowercase());

View File

@ -415,10 +415,10 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
} }
static { static {
assert Version.CURRENT.minimumCompatibilityVersion().after(Version.V_5_0_0) == false: assert Version.CURRENT.minimumCompatibilityVersion().after(Version.V_6_0_0_alpha1_UNRELEASED) == false:
"Remove logic handling NoOp result from primary response; see TODO in replicaItemExecutionMode" + "Remove logic handling NoOp result from primary response; see TODO in replicaItemExecutionMode" +
" as the current minimum compatible version [" + " as the current minimum compatible version [" +
Version.CURRENT.minimumCompatibilityVersion() + "] is after 5.0"; Version.CURRENT.minimumCompatibilityVersion() + "] is after 6.0";
} }
/** /**

View File

@ -323,14 +323,14 @@ public abstract class FieldStats<T> implements Writeable, ToXContent {
out.writeLong(sumTotalTermFreq); out.writeLong(sumTotalTermFreq);
out.writeBoolean(isSearchable); out.writeBoolean(isSearchable);
out.writeBoolean(isAggregatable); out.writeBoolean(isAggregatable);
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_2_0)) {
out.writeBoolean(hasMinMax); out.writeBoolean(hasMinMax);
if (hasMinMax) { if (hasMinMax) {
writeMinMax(out); writeMinMax(out);
} }
} else { } else {
assert hasMinMax : "cannot serialize null min/max fieldstats in a mixed-cluster " + assert hasMinMax : "cannot serialize null min/max fieldstats in a mixed-cluster " +
"with pre-" + Version.V_5_2_0_UNRELEASED + " nodes, remote version [" + out.getVersion() + "]"; "with pre-" + Version.V_5_2_0 + " nodes, remote version [" + out.getVersion() + "]";
writeMinMax(out); writeMinMax(out);
} }
} }
@ -705,7 +705,7 @@ public abstract class FieldStats<T> implements Writeable, ToXContent {
boolean isSearchable = in.readBoolean(); boolean isSearchable = in.readBoolean();
boolean isAggregatable = in.readBoolean(); boolean isAggregatable = in.readBoolean();
boolean hasMinMax = true; boolean hasMinMax = true;
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_2_0)) {
hasMinMax = in.readBoolean(); hasMinMax = in.readBoolean();
} }
switch (type) { switch (type) {

View File

@ -93,7 +93,7 @@ public class FieldStatsResponse extends BroadcastResponse {
for (Map.Entry<String, Map<String, FieldStats>> entry1 : indicesMergedFieldStats.entrySet()) { for (Map.Entry<String, Map<String, FieldStats>> entry1 : indicesMergedFieldStats.entrySet()) {
out.writeString(entry1.getKey()); out.writeString(entry1.getKey());
int size = entry1.getValue().size(); int size = entry1.getValue().size();
if (out.getVersion().before(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().before(Version.V_5_2_0)) {
// filter fieldstats without min/max information // filter fieldstats without min/max information
for (FieldStats stats : entry1.getValue().values()) { for (FieldStats stats : entry1.getValue().values()) {
if (stats.hasMinMax() == false) { if (stats.hasMinMax() == false) {
@ -103,7 +103,7 @@ public class FieldStatsResponse extends BroadcastResponse {
} }
out.writeVInt(size); out.writeVInt(size);
for (Map.Entry<String, FieldStats> entry2 : entry1.getValue().entrySet()) { for (Map.Entry<String, FieldStats> entry2 : entry1.getValue().entrySet()) {
if (entry2.getValue().hasMinMax() || out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (entry2.getValue().hasMinMax() || out.getVersion().onOrAfter(Version.V_5_2_0)) {
out.writeString(entry2.getKey()); out.writeString(entry2.getKey());
entry2.getValue().writeTo(out); entry2.getValue().writeTo(out);
} }

View File

@ -68,7 +68,7 @@ public class FieldStatsShardResponse extends BroadcastShardResponse {
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out); super.writeTo(out);
final Map<String, FieldStats<?> > stats; final Map<String, FieldStats<?> > stats;
if (out.getVersion().before(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().before(Version.V_5_2_0)) {
/** /**
* FieldStats with null min/max are not (de)serializable in versions prior to {@link Version.V_5_2_0_UNRELEASED} * FieldStats with null min/max are not (de)serializable in versions prior to {@link Version.V_5_2_0_UNRELEASED}
*/ */

View File

@ -534,7 +534,7 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
pipeline = in.readOptionalString(); pipeline = in.readOptionalString();
isRetry = in.readBoolean(); isRetry = in.readBoolean();
autoGeneratedTimestamp = in.readLong(); autoGeneratedTimestamp = in.readLong();
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
contentType = in.readOptionalWriteable(XContentType::readFrom); contentType = in.readOptionalWriteable(XContentType::readFrom);
} else { } else {
contentType = XContentFactory.xContentType(source); contentType = XContentFactory.xContentType(source);
@ -558,7 +558,7 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
out.writeBytesReference(source); out.writeBytesReference(source);
out.writeByte(opType.getId()); out.writeByte(opType.getId());
// ES versions below 5.1.2 don't know about resolveVersionDefaults but resolve the version eagerly (which messes with validation). // ES versions below 5.1.2 don't know about resolveVersionDefaults but resolve the version eagerly (which messes with validation).
if (out.getVersion().before(Version.V_5_1_2_UNRELEASED)) { if (out.getVersion().before(Version.V_5_1_2)) {
out.writeLong(resolveVersionDefaults()); out.writeLong(resolveVersionDefaults());
} else { } else {
out.writeLong(version); out.writeLong(version);
@ -567,7 +567,7 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
out.writeOptionalString(pipeline); out.writeOptionalString(pipeline);
out.writeBoolean(isRetry); out.writeBoolean(isRetry);
out.writeLong(autoGeneratedTimestamp); out.writeLong(autoGeneratedTimestamp);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
out.writeOptionalWriteable(contentType); out.writeOptionalWriteable(contentType);
} }
} }

View File

@ -80,7 +80,7 @@ public class PutPipelineRequest extends AcknowledgedRequest<PutPipelineRequest>
super.readFrom(in); super.readFrom(in);
id = in.readString(); id = in.readString();
source = in.readBytesReference(); source = in.readBytesReference();
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType = XContentType.readFrom(in); xContentType = XContentType.readFrom(in);
} else { } else {
xContentType = XContentFactory.xContentType(source); xContentType = XContentFactory.xContentType(source);
@ -92,7 +92,7 @@ public class PutPipelineRequest extends AcknowledgedRequest<PutPipelineRequest>
super.writeTo(out); super.writeTo(out);
out.writeString(id); out.writeString(id);
out.writeBytesReference(source); out.writeBytesReference(source);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType.writeTo(out); xContentType.writeTo(out);
} }
} }

View File

@ -103,7 +103,7 @@ public class SimulatePipelineRequest extends ActionRequest {
id = in.readOptionalString(); id = in.readOptionalString();
verbose = in.readBoolean(); verbose = in.readBoolean();
source = in.readBytesReference(); source = in.readBytesReference();
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType = XContentType.readFrom(in); xContentType = XContentType.readFrom(in);
} else { } else {
xContentType = XContentFactory.xContentType(source); xContentType = XContentFactory.xContentType(source);
@ -116,7 +116,7 @@ public class SimulatePipelineRequest extends ActionRequest {
out.writeOptionalString(id); out.writeOptionalString(id);
out.writeBoolean(verbose); out.writeBoolean(verbose);
out.writeBytesReference(source); out.writeBytesReference(source);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType.writeTo(out); xContentType.writeTo(out);
} }
} }

View File

@ -120,7 +120,7 @@ public class SearchTransportService extends AbstractComponent {
// this used to be the QUERY_AND_FETCH which doesn't exists anymore. // this used to be the QUERY_AND_FETCH which doesn't exists anymore.
final boolean fetchDocuments = request.numberOfShards() == 1; final boolean fetchDocuments = request.numberOfShards() == 1;
Supplier<SearchPhaseResult> supplier = fetchDocuments ? QueryFetchSearchResult::new : QuerySearchResult::new; Supplier<SearchPhaseResult> supplier = fetchDocuments ? QueryFetchSearchResult::new : QuerySearchResult::new;
if (connection.getVersion().before(Version.V_5_3_0_UNRELEASED) && fetchDocuments) { if (connection.getVersion().before(Version.V_5_3_0) && fetchDocuments) {
// this is a BWC layer for pre 5.3 indices // this is a BWC layer for pre 5.3 indices
if (request.scroll() != null) { if (request.scroll() != null) {
/** /**

View File

@ -499,7 +499,7 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
if (in.readBoolean()) { if (in.readBoolean()) {
doc = in.readBytesReference(); doc = in.readBytesReference();
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType = XContentType.readFrom(in); xContentType = XContentType.readFrom(in);
} else { } else {
xContentType = XContentFactory.xContentType(doc); xContentType = XContentFactory.xContentType(doc);
@ -544,7 +544,7 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
out.writeBoolean(doc != null); out.writeBoolean(doc != null);
if (doc != null) { if (doc != null) {
out.writeBytesReference(doc); out.writeBytesReference(doc);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType.writeTo(out); xContentType.writeTo(out);
} }
} }

View File

@ -30,7 +30,7 @@ public interface NamedDiff<T extends Diffable<T>> extends Diff<T>, NamedWriteabl
* The minimal version of the recipient this custom object can be sent to * The minimal version of the recipient this custom object can be sent to
*/ */
default Version getMinimalSupportedVersion() { default Version getMinimalSupportedVersion() {
return Version.CURRENT.minimumCompatibilityVersion(); return Version.CURRENT.minimumIndexCompatibilityVersion();
} }
} }

View File

@ -30,6 +30,6 @@ public interface NamedDiffable<T> extends Diffable<T>, NamedWriteable {
* The minimal version of the recipient this custom object can be sent to * The minimal version of the recipient this custom object can be sent to
*/ */
default Version getMinimalSupportedVersion() { default Version getMinimalSupportedVersion() {
return Version.CURRENT.minimumCompatibilityVersion(); return Version.CURRENT.minimumIndexCompatibilityVersion();
} }
} }

View File

@ -40,7 +40,7 @@ public class SnapshotDeletionsInProgress extends AbstractNamedDiffable<Custom> i
public static final String TYPE = "snapshot_deletions"; public static final String TYPE = "snapshot_deletions";
// the version where SnapshotDeletionsInProgress was introduced // the version where SnapshotDeletionsInProgress was introduced
public static final Version VERSION_INTRODUCED = Version.V_5_2_0_UNRELEASED; public static final Version VERSION_INTRODUCED = Version.V_5_2_0;
// the list of snapshot deletion request entries // the list of snapshot deletion request entries
private final List<Entry> entries; private final List<Entry> entries;

View File

@ -51,7 +51,7 @@ public class SnapshotsInProgress extends AbstractNamedDiffable<Custom> implement
// a snapshot in progress from a pre 5.2.x node // a snapshot in progress from a pre 5.2.x node
public static final long UNDEFINED_REPOSITORY_STATE_ID = -2L; public static final long UNDEFINED_REPOSITORY_STATE_ID = -2L;
// the version where repository state ids were introduced // the version where repository state ids were introduced
private static final Version REPOSITORY_ID_INTRODUCED_VERSION = Version.V_5_2_0_UNRELEASED; private static final Version REPOSITORY_ID_INTRODUCED_VERSION = Version.V_5_2_0;
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {

View File

@ -34,7 +34,6 @@ import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate; import java.util.function.Predicate;
@ -222,7 +221,7 @@ public class DiscoveryNode implements Writeable, ToXContent {
this.ephemeralId = in.readString().intern(); this.ephemeralId = in.readString().intern();
this.hostName = in.readString().intern(); this.hostName = in.readString().intern();
this.hostAddress = in.readString().intern(); this.hostAddress = in.readString().intern();
if (in.getVersion().onOrAfter(Version.V_5_0_3_UNRELEASED)) { if (in.getVersion().after(Version.V_5_0_2)) {
this.address = new TransportAddress(in); this.address = new TransportAddress(in);
} else { } else {
// we need to do this to preserve the host information during pinging and joining of a master. Since the version of the // we need to do this to preserve the host information during pinging and joining of a master. Since the version of the

View File

@ -80,7 +80,7 @@ public class NodeAllocationResult implements ToXContent, Writeable, Comparable<N
public NodeAllocationResult(StreamInput in) throws IOException { public NodeAllocationResult(StreamInput in) throws IOException {
node = new DiscoveryNode(in); node = new DiscoveryNode(in);
shardStoreInfo = in.readOptionalWriteable(ShardStoreInfo::new); shardStoreInfo = in.readOptionalWriteable(ShardStoreInfo::new);
if (in.getVersion().before(Version.V_5_2_1_UNRELEASED)) { if (in.getVersion().before(Version.V_5_2_1)) {
canAllocateDecision = Decision.readFrom(in); canAllocateDecision = Decision.readFrom(in);
} else { } else {
canAllocateDecision = in.readOptionalWriteable(Decision::readFrom); canAllocateDecision = in.readOptionalWriteable(Decision::readFrom);
@ -93,7 +93,7 @@ public class NodeAllocationResult implements ToXContent, Writeable, Comparable<N
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
node.writeTo(out); node.writeTo(out);
out.writeOptionalWriteable(shardStoreInfo); out.writeOptionalWriteable(shardStoreInfo);
if (out.getVersion().before(Version.V_5_2_1_UNRELEASED)) { if (out.getVersion().before(Version.V_5_2_1)) {
if (canAllocateDecision == null) { if (canAllocateDecision == null) {
Decision.NO.writeTo(out); Decision.NO.writeTo(out);
} else { } else {

View File

@ -74,8 +74,8 @@ public final class TransportAddress implements Writeable {
} }
/** /**
* Read from a stream and use the {@code hostString} when creating the InetAddress if the input comes from a version prior * Read from a stream and use the {@code hostString} when creating the InetAddress if the input comes from a version on or prior
* {@link Version#V_5_0_3_UNRELEASED} as the hostString was not serialized * {@link Version#V_5_0_2} as the hostString was not serialized
*/ */
public TransportAddress(StreamInput in, @Nullable String hostString) throws IOException { public TransportAddress(StreamInput in, @Nullable String hostString) throws IOException {
if (in.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) { // bwc layer for 5.x where we had more than one transport address if (in.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) { // bwc layer for 5.x where we had more than one transport address
@ -88,7 +88,7 @@ public final class TransportAddress implements Writeable {
final byte[] a = new byte[len]; // 4 bytes (IPv4) or 16 bytes (IPv6) final byte[] a = new byte[len]; // 4 bytes (IPv4) or 16 bytes (IPv6)
in.readFully(a); in.readFully(a);
final InetAddress inetAddress; final InetAddress inetAddress;
if (in.getVersion().onOrAfter(Version.V_5_0_3_UNRELEASED)) { if (in.getVersion().after(Version.V_5_0_2)) {
String host = in.readString(); // the host string was serialized so we can ignore the passed in version String host = in.readString(); // the host string was serialized so we can ignore the passed in version
inetAddress = InetAddress.getByAddress(host, a); inetAddress = InetAddress.getByAddress(host, a);
} else { } else {
@ -107,7 +107,7 @@ public final class TransportAddress implements Writeable {
byte[] bytes = address.getAddress().getAddress(); // 4 bytes (IPv4) or 16 bytes (IPv6) byte[] bytes = address.getAddress().getAddress(); // 4 bytes (IPv4) or 16 bytes (IPv6)
out.writeByte((byte) bytes.length); // 1 byte out.writeByte((byte) bytes.length); // 1 byte
out.write(bytes, 0, bytes.length); out.write(bytes, 0, bytes.length);
if (out.getVersion().onOrAfter(Version.V_5_0_3_UNRELEASED)) { if (out.getVersion().after(Version.V_5_0_2)) {
out.writeString(address.getHostString()); out.writeString(address.getHostString());
} }
// don't serialize scope ids over the network!!!! // don't serialize scope ids over the network!!!!

View File

@ -223,7 +223,7 @@ public class GatewayMetaState extends AbstractComponent implements ClusterStateA
final String name = stateFile.getFileName().toString(); final String name = stateFile.getFileName().toString();
if (name.startsWith("metadata-")) { if (name.startsWith("metadata-")) {
throw new IllegalStateException("Detected pre 0.19 metadata file please upgrade to a version before " throw new IllegalStateException("Detected pre 0.19 metadata file please upgrade to a version before "
+ Version.CURRENT.minimumCompatibilityVersion() + Version.CURRENT.minimumIndexCompatibilityVersion()
+ " first to upgrade state structures - metadata found: [" + stateFile.getParent().toAbsolutePath()); + " first to upgrade state structures - metadata found: [" + stateFile.getParent().toAbsolutePath());
} }
} }
@ -294,7 +294,7 @@ public class GatewayMetaState extends AbstractComponent implements ClusterStateA
try (DirectoryStream<Path> stream = Files.newDirectoryStream(stateLocation, "shards-*")) { try (DirectoryStream<Path> stream = Files.newDirectoryStream(stateLocation, "shards-*")) {
for (Path stateFile : stream) { for (Path stateFile : stream) {
throw new IllegalStateException("Detected pre 0.19 shard state file please upgrade to a version before " throw new IllegalStateException("Detected pre 0.19 shard state file please upgrade to a version before "
+ Version.CURRENT.minimumCompatibilityVersion() + Version.CURRENT.minimumIndexCompatibilityVersion()
+ " first to upgrade state structures - shard state found: [" + stateFile.getParent().toAbsolutePath()); + " first to upgrade state structures - shard state found: [" + stateFile.getParent().toAbsolutePath());
} }
} }

View File

@ -213,7 +213,7 @@ public final class InnerHitBuilder extends ToXContentToBytes implements Writeabl
name = in.readOptionalString(); name = in.readOptionalString();
nestedPath = in.readOptionalString(); nestedPath = in.readOptionalString();
parentChildType = in.readOptionalString(); parentChildType = in.readOptionalString();
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_2_0)) {
ignoreUnmapped = in.readBoolean(); ignoreUnmapped = in.readBoolean();
} }
from = in.readVInt(); from = in.readVInt();
@ -254,7 +254,7 @@ public final class InnerHitBuilder extends ToXContentToBytes implements Writeabl
out.writeOptionalString(name); out.writeOptionalString(name);
out.writeOptionalString(nestedPath); out.writeOptionalString(nestedPath);
out.writeOptionalString(parentChildType); out.writeOptionalString(parentChildType);
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_2_0)) {
out.writeBoolean(ignoreUnmapped); out.writeBoolean(ignoreUnmapped);
} }
out.writeVInt(from); out.writeVInt(from);

View File

@ -228,7 +228,7 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder<MoreLikeThisQ
type = in.readOptionalString(); type = in.readOptionalString();
if (in.readBoolean()) { if (in.readBoolean()) {
doc = (BytesReference) in.readGenericValue(); doc = (BytesReference) in.readGenericValue();
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType = XContentType.readFrom(in); xContentType = XContentType.readFrom(in);
} else { } else {
xContentType = XContentFactory.xContentType(doc); xContentType = XContentFactory.xContentType(doc);
@ -250,7 +250,7 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder<MoreLikeThisQ
out.writeBoolean(doc != null); out.writeBoolean(doc != null);
if (doc != null) { if (doc != null) {
out.writeGenericValue(doc); out.writeGenericValue(doc);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType.writeTo(out); xContentType.writeTo(out);
} }
} else { } else {

View File

@ -212,11 +212,11 @@ public class QueryStringQueryBuilder extends AbstractQueryBuilder<QueryStringQue
autoGeneratePhraseQueries = in.readBoolean(); autoGeneratePhraseQueries = in.readBoolean();
allowLeadingWildcard = in.readOptionalBoolean(); allowLeadingWildcard = in.readOptionalBoolean();
analyzeWildcard = in.readOptionalBoolean(); analyzeWildcard = in.readOptionalBoolean();
if (in.getVersion().before(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().before(Version.V_5_1_1)) {
in.readBoolean(); // lowercase_expanded_terms in.readBoolean(); // lowercase_expanded_terms
} }
enablePositionIncrements = in.readBoolean(); enablePositionIncrements = in.readBoolean();
if (in.getVersion().before(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().before(Version.V_5_1_1)) {
in.readString(); // locale in.readString(); // locale
} }
fuzziness = new Fuzziness(in); fuzziness = new Fuzziness(in);
@ -232,7 +232,7 @@ public class QueryStringQueryBuilder extends AbstractQueryBuilder<QueryStringQue
timeZone = in.readOptionalTimeZone(); timeZone = in.readOptionalTimeZone();
escape = in.readBoolean(); escape = in.readBoolean();
maxDeterminizedStates = in.readVInt(); maxDeterminizedStates = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
splitOnWhitespace = in.readBoolean(); splitOnWhitespace = in.readBoolean();
useAllFields = in.readOptionalBoolean(); useAllFields = in.readOptionalBoolean();
} else { } else {
@ -256,11 +256,11 @@ public class QueryStringQueryBuilder extends AbstractQueryBuilder<QueryStringQue
out.writeBoolean(this.autoGeneratePhraseQueries); out.writeBoolean(this.autoGeneratePhraseQueries);
out.writeOptionalBoolean(this.allowLeadingWildcard); out.writeOptionalBoolean(this.allowLeadingWildcard);
out.writeOptionalBoolean(this.analyzeWildcard); out.writeOptionalBoolean(this.analyzeWildcard);
if (out.getVersion().before(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().before(Version.V_5_1_1)) {
out.writeBoolean(true); // lowercase_expanded_terms out.writeBoolean(true); // lowercase_expanded_terms
} }
out.writeBoolean(this.enablePositionIncrements); out.writeBoolean(this.enablePositionIncrements);
if (out.getVersion().before(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().before(Version.V_5_1_1)) {
out.writeString(Locale.ROOT.toLanguageTag()); // locale out.writeString(Locale.ROOT.toLanguageTag()); // locale
} }
this.fuzziness.writeTo(out); this.fuzziness.writeTo(out);
@ -276,7 +276,7 @@ public class QueryStringQueryBuilder extends AbstractQueryBuilder<QueryStringQue
out.writeOptionalTimeZone(timeZone); out.writeOptionalTimeZone(timeZone);
out.writeBoolean(this.escape); out.writeBoolean(this.escape);
out.writeVInt(this.maxDeterminizedStates); out.writeVInt(this.maxDeterminizedStates);
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeBoolean(this.splitOnWhitespace); out.writeBoolean(this.splitOnWhitespace);
out.writeOptionalBoolean(this.useAllFields); out.writeOptionalBoolean(this.useAllFields);
} }

View File

@ -112,7 +112,7 @@ public class RangeQueryBuilder extends AbstractQueryBuilder<RangeQueryBuilder> i
if (formatString != null) { if (formatString != null) {
format = Joda.forPattern(formatString); format = Joda.forPattern(formatString);
} }
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_2_0)) {
String relationString = in.readOptionalString(); String relationString = in.readOptionalString();
if (relationString != null) { if (relationString != null) {
relation = ShapeRelation.getRelationByName(relationString); relation = ShapeRelation.getRelationByName(relationString);
@ -133,7 +133,7 @@ public class RangeQueryBuilder extends AbstractQueryBuilder<RangeQueryBuilder> i
formatString = this.format.format(); formatString = this.format.format();
} }
out.writeOptionalString(formatString); out.writeOptionalString(formatString);
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_2_0)) {
String relationString = null; String relationString = null;
if (this.relation != null) { if (this.relation != null) {
relationString = this.relation.getRelationName(); relationString = this.relation.getRelationName();

View File

@ -157,19 +157,19 @@ public class SimpleQueryStringBuilder extends AbstractQueryBuilder<SimpleQuerySt
flags = in.readInt(); flags = in.readInt();
analyzer = in.readOptionalString(); analyzer = in.readOptionalString();
defaultOperator = Operator.readFromStream(in); defaultOperator = Operator.readFromStream(in);
if (in.getVersion().before(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().before(Version.V_5_1_1)) {
in.readBoolean(); // lowercase_expanded_terms in.readBoolean(); // lowercase_expanded_terms
} }
settings.lenient(in.readBoolean()); settings.lenient(in.readBoolean());
if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
this.lenientSet = in.readBoolean(); this.lenientSet = in.readBoolean();
} }
settings.analyzeWildcard(in.readBoolean()); settings.analyzeWildcard(in.readBoolean());
if (in.getVersion().before(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().before(Version.V_5_1_1)) {
in.readString(); // locale in.readString(); // locale
} }
minimumShouldMatch = in.readOptionalString(); minimumShouldMatch = in.readOptionalString();
if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
settings.quoteFieldSuffix(in.readOptionalString()); settings.quoteFieldSuffix(in.readOptionalString());
useAllFields = in.readOptionalBoolean(); useAllFields = in.readOptionalBoolean();
} }
@ -186,19 +186,19 @@ public class SimpleQueryStringBuilder extends AbstractQueryBuilder<SimpleQuerySt
out.writeInt(flags); out.writeInt(flags);
out.writeOptionalString(analyzer); out.writeOptionalString(analyzer);
defaultOperator.writeTo(out); defaultOperator.writeTo(out);
if (out.getVersion().before(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().before(Version.V_5_1_1)) {
out.writeBoolean(true); // lowercase_expanded_terms out.writeBoolean(true); // lowercase_expanded_terms
} }
out.writeBoolean(settings.lenient()); out.writeBoolean(settings.lenient());
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeBoolean(lenientSet); out.writeBoolean(lenientSet);
} }
out.writeBoolean(settings.analyzeWildcard()); out.writeBoolean(settings.analyzeWildcard());
if (out.getVersion().before(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().before(Version.V_5_1_1)) {
out.writeString(Locale.ROOT.toLanguageTag()); // locale out.writeString(Locale.ROOT.toLanguageTag()); // locale
} }
out.writeOptionalString(minimumShouldMatch); out.writeOptionalString(minimumShouldMatch);
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeOptionalString(settings.quoteFieldSuffix()); out.writeOptionalString(settings.quoteFieldSuffix());
out.writeOptionalBoolean(useAllFields); out.writeOptionalBoolean(useAllFields);
} }

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.refresh; package org.elasticsearch.index.refresh;
import org.elasticsearch.Version;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable; import org.elasticsearch.common.io.stream.Streamable;
@ -106,20 +105,14 @@ public class RefreshStats implements Streamable, ToXContent {
public void readFrom(StreamInput in) throws IOException { public void readFrom(StreamInput in) throws IOException {
total = in.readVLong(); total = in.readVLong();
totalTimeInMillis = in.readVLong(); totalTimeInMillis = in.readVLong();
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { listeners = in.readVInt();
listeners = in.readVInt();
} else {
listeners = 0;
}
} }
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(total); out.writeVLong(total);
out.writeVLong(totalTimeInMillis); out.writeVLong(totalTimeInMillis);
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { out.writeVInt(listeners);
out.writeVInt(listeners);
}
} }
@Override @Override

View File

@ -402,7 +402,7 @@ public abstract class AbstractBulkByScrollRequest<Self extends AbstractBulkByScr
retryBackoffInitialTime = new TimeValue(in); retryBackoffInitialTime = new TimeValue(in);
maxRetries = in.readVInt(); maxRetries = in.readVInt();
requestsPerSecond = in.readFloat(); requestsPerSecond = in.readFloat();
if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
slices = in.readVInt(); slices = in.readVInt();
} else { } else {
slices = 1; slices = 1;
@ -421,12 +421,12 @@ public abstract class AbstractBulkByScrollRequest<Self extends AbstractBulkByScr
retryBackoffInitialTime.writeTo(out); retryBackoffInitialTime.writeTo(out);
out.writeVInt(maxRetries); out.writeVInt(maxRetries);
out.writeFloat(requestsPerSecond); out.writeFloat(requestsPerSecond);
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeVInt(slices); out.writeVInt(slices);
} else { } else {
if (slices > 1) { if (slices > 1) {
throw new IllegalArgumentException("Attempting to send sliced reindex-style request to a node that doesn't support " throw new IllegalArgumentException("Attempting to send sliced reindex-style request to a node that doesn't support "
+ "it. Version is [" + out.getVersion() + "] but must be [" + Version.V_5_1_1_UNRELEASED + "]"); + "it. Version is [" + out.getVersion() + "] but must be [" + Version.V_5_1_1 + "]");
} }
} }
} }

View File

@ -189,7 +189,7 @@ public abstract class BulkByScrollTask extends CancellableTask {
} }
public Status(StreamInput in) throws IOException { public Status(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
sliceId = in.readOptionalVInt(); sliceId = in.readOptionalVInt();
} else { } else {
sliceId = null; sliceId = null;
@ -207,7 +207,7 @@ public abstract class BulkByScrollTask extends CancellableTask {
requestsPerSecond = in.readFloat(); requestsPerSecond = in.readFloat();
reasonCancelled = in.readOptionalString(); reasonCancelled = in.readOptionalString();
throttledUntil = new TimeValue(in); throttledUntil = new TimeValue(in);
if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
sliceStatuses = in.readList(stream -> stream.readOptionalWriteable(StatusOrException::new)); sliceStatuses = in.readList(stream -> stream.readOptionalWriteable(StatusOrException::new));
} else { } else {
sliceStatuses = emptyList(); sliceStatuses = emptyList();
@ -216,7 +216,7 @@ public abstract class BulkByScrollTask extends CancellableTask {
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeOptionalVInt(sliceId); out.writeOptionalVInt(sliceId);
} }
out.writeVLong(total); out.writeVLong(total);
@ -232,7 +232,7 @@ public abstract class BulkByScrollTask extends CancellableTask {
out.writeFloat(requestsPerSecond); out.writeFloat(requestsPerSecond);
out.writeOptionalString(reasonCancelled); out.writeOptionalString(reasonCancelled);
throttledUntil.writeTo(out); throttledUntil.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeVInt(sliceStatuses.size()); out.writeVInt(sliceStatuses.size());
for (StatusOrException sliceStatus : sliceStatuses) { for (StatusOrException sliceStatus : sliceStatuses) {
out.writeOptionalWriteable(sliceStatus); out.writeOptionalWriteable(sliceStatus);

View File

@ -90,7 +90,7 @@ public class RemoteInfo implements Writeable {
headers.put(in.readString(), in.readString()); headers.put(in.readString(), in.readString());
} }
this.headers = unmodifiableMap(headers); this.headers = unmodifiableMap(headers);
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_2_0)) {
socketTimeout = new TimeValue(in); socketTimeout = new TimeValue(in);
connectTimeout = new TimeValue(in); connectTimeout = new TimeValue(in);
} else { } else {
@ -112,7 +112,7 @@ public class RemoteInfo implements Writeable {
out.writeString(header.getKey()); out.writeString(header.getKey());
out.writeString(header.getValue()); out.writeString(header.getValue());
} }
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_2_0)) {
socketTimeout.writeTo(out); socketTimeout.writeTo(out);
connectTimeout.writeTo(out); connectTimeout.writeTo(out);
} }

View File

@ -118,7 +118,7 @@ public final class PipelineConfiguration extends AbstractDiffable<PipelineConfig
} }
public static PipelineConfiguration readFrom(StreamInput in) throws IOException { public static PipelineConfiguration readFrom(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
return new PipelineConfiguration(in.readString(), in.readBytesReference(), XContentType.readFrom(in)); return new PipelineConfiguration(in.readString(), in.readBytesReference(), XContentType.readFrom(in));
} else { } else {
final String id = in.readString(); final String id = in.readString();
@ -135,7 +135,7 @@ public final class PipelineConfiguration extends AbstractDiffable<PipelineConfig
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
out.writeString(id); out.writeString(id);
out.writeBytesReference(config); out.writeBytesReference(config);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
xContentType.writeTo(out); xContentType.writeTo(out);
} }
} }

View File

@ -52,7 +52,7 @@ public class OsStats implements Writeable, ToXContent {
this.cpu = new Cpu(in); this.cpu = new Cpu(in);
this.mem = new Mem(in); this.mem = new Mem(in);
this.swap = new Swap(in); this.swap = new Swap(in);
if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
this.cgroup = in.readOptionalWriteable(Cgroup::new); this.cgroup = in.readOptionalWriteable(Cgroup::new);
} else { } else {
this.cgroup = null; this.cgroup = null;
@ -65,7 +65,7 @@ public class OsStats implements Writeable, ToXContent {
cpu.writeTo(out); cpu.writeTo(out);
mem.writeTo(out); mem.writeTo(out);
swap.writeTo(out); swap.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeOptionalWriteable(cgroup); out.writeOptionalWriteable(cgroup);
} }
} }

View File

@ -81,7 +81,7 @@ public class PluginInfo implements Writeable, ToXContent {
this.description = in.readString(); this.description = in.readString();
this.version = in.readString(); this.version = in.readString();
this.classname = in.readString(); this.classname = in.readString();
if (in.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_4_0)) {
hasNativeController = in.readBoolean(); hasNativeController = in.readBoolean();
} else { } else {
hasNativeController = false; hasNativeController = false;
@ -94,7 +94,7 @@ public class PluginInfo implements Writeable, ToXContent {
out.writeString(description); out.writeString(description);
out.writeString(version); out.writeString(version);
out.writeString(classname); out.writeString(classname);
if (out.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_4_0)) {
out.writeBoolean(hasNativeController); out.writeBoolean(hasNativeController);
} }
} }

View File

@ -485,7 +485,7 @@ public final class Script implements ToXContentObject, Writeable {
public Script(StreamInput in) throws IOException { public Script(StreamInput in) throws IOException {
// Version 5.3 allows lang to be an optional parameter for stored scripts and expects // Version 5.3 allows lang to be an optional parameter for stored scripts and expects
// options to be null for stored and file scripts. // options to be null for stored and file scripts.
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
this.type = ScriptType.readFrom(in); this.type = ScriptType.readFrom(in);
this.lang = in.readOptionalString(); this.lang = in.readOptionalString();
this.idOrCode = in.readString(); this.idOrCode = in.readString();
@ -496,7 +496,7 @@ public final class Script implements ToXContentObject, Writeable {
// Version 5.1 to 5.3 (exclusive) requires all Script members to be non-null and supports the potential // Version 5.1 to 5.3 (exclusive) requires all Script members to be non-null and supports the potential
// for more options than just XContentType. Reorders the read in contents to be in // for more options than just XContentType. Reorders the read in contents to be in
// same order as the constructor. // same order as the constructor.
} else if (in.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { } else if (in.getVersion().onOrAfter(Version.V_5_1_1)) {
this.type = ScriptType.readFrom(in); this.type = ScriptType.readFrom(in);
this.lang = in.readString(); this.lang = in.readString();
@ -554,7 +554,7 @@ public final class Script implements ToXContentObject, Writeable {
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
// Version 5.3+ allows lang to be an optional parameter for stored scripts and expects // Version 5.3+ allows lang to be an optional parameter for stored scripts and expects
// options to be null for stored and file scripts. // options to be null for stored and file scripts.
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
type.writeTo(out); type.writeTo(out);
out.writeOptionalString(lang); out.writeOptionalString(lang);
out.writeString(idOrCode); out.writeString(idOrCode);
@ -565,7 +565,7 @@ public final class Script implements ToXContentObject, Writeable {
// Version 5.1 to 5.3 (exclusive) requires all Script members to be non-null and supports the potential // Version 5.1 to 5.3 (exclusive) requires all Script members to be non-null and supports the potential
// for more options than just XContentType. Reorders the written out contents to be in // for more options than just XContentType. Reorders the written out contents to be in
// same order as the constructor. // same order as the constructor.
} else if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { } else if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
type.writeTo(out); type.writeTo(out);
if (lang == null) { if (lang == null) {

View File

@ -329,7 +329,7 @@ public final class ScriptMetaData implements MetaData.Custom, Writeable, ToXCont
// Split the id to find the language then use StoredScriptSource to parse the // Split the id to find the language then use StoredScriptSource to parse the
// expected BytesReference after which a new StoredScriptSource is created // expected BytesReference after which a new StoredScriptSource is created
// with the appropriate language and options. // with the appropriate language and options.
if (in.getVersion().before(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().before(Version.V_5_3_0)) {
int split = id.indexOf('#'); int split = id.indexOf('#');
if (split == -1) { if (split == -1) {
@ -353,7 +353,7 @@ public final class ScriptMetaData implements MetaData.Custom, Writeable, ToXCont
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
// Version 5.3+ will output the contents of the scripts' Map using // Version 5.3+ will output the contents of the scripts' Map using
// StoredScriptSource to stored the language, code, and options. // StoredScriptSource to stored the language, code, and options.
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
out.writeVInt(scripts.size()); out.writeVInt(scripts.size());
for (Map.Entry<String, StoredScriptSource> entry : scripts.entrySet()) { for (Map.Entry<String, StoredScriptSource> entry : scripts.entrySet()) {

View File

@ -365,7 +365,7 @@ public class StoredScriptSource extends AbstractDiffable<StoredScriptSource> imp
* only the code parameter will be read in as a bytes reference. * only the code parameter will be read in as a bytes reference.
*/ */
public StoredScriptSource(StreamInput in) throws IOException { public StoredScriptSource(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
this.lang = in.readString(); this.lang = in.readString();
this.code = in.readString(); this.code = in.readString();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -385,7 +385,7 @@ public class StoredScriptSource extends AbstractDiffable<StoredScriptSource> imp
*/ */
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
out.writeString(lang); out.writeString(lang);
out.writeString(code); out.writeString(code);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -427,7 +427,7 @@ public class IncludeExclude implements Writeable, ToXContent {
} else { } else {
excludeValues = null; excludeValues = null;
} }
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_2_0)) {
incNumPartitions = in.readVInt(); incNumPartitions = in.readVInt();
incZeroBasedPartition = in.readVInt(); incZeroBasedPartition = in.readVInt();
} else { } else {
@ -460,7 +460,7 @@ public class IncludeExclude implements Writeable, ToXContent {
out.writeBytesRef(value); out.writeBytesRef(value);
} }
} }
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_2_0)) {
out.writeVInt(incNumPartitions); out.writeVInt(incNumPartitions);
out.writeVInt(incZeroBasedPartition); out.writeVInt(incZeroBasedPartition);
} }

View File

@ -220,7 +220,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
profile = in.readBoolean(); profile = in.readBoolean();
searchAfterBuilder = in.readOptionalWriteable(SearchAfterBuilder::new); searchAfterBuilder = in.readOptionalWriteable(SearchAfterBuilder::new);
sliceBuilder = in.readOptionalWriteable(SliceBuilder::new); sliceBuilder = in.readOptionalWriteable(SliceBuilder::new);
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
collapse = in.readOptionalWriteable(CollapseBuilder::new); collapse = in.readOptionalWriteable(CollapseBuilder::new);
} }
} }
@ -271,7 +271,7 @@ public final class SearchSourceBuilder extends ToXContentToBytes implements Writ
out.writeBoolean(profile); out.writeBoolean(profile);
out.writeOptionalWriteable(searchAfterBuilder); out.writeOptionalWriteable(searchAfterBuilder);
out.writeOptionalWriteable(sliceBuilder); out.writeOptionalWriteable(sliceBuilder);
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_3_0)) {
out.writeOptionalWriteable(collapse); out.writeOptionalWriteable(collapse);
} }
} }

View File

@ -128,14 +128,14 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
order(in.readOptionalWriteable(Order::readFromStream)); order(in.readOptionalWriteable(Order::readFromStream));
highlightFilter(in.readOptionalBoolean()); highlightFilter(in.readOptionalBoolean());
forceSource(in.readOptionalBoolean()); forceSource(in.readOptionalBoolean());
if (in.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_4_0)) {
boundaryScannerType(in.readOptionalWriteable(BoundaryScannerType::readFromStream)); boundaryScannerType(in.readOptionalWriteable(BoundaryScannerType::readFromStream));
} }
boundaryMaxScan(in.readOptionalVInt()); boundaryMaxScan(in.readOptionalVInt());
if (in.readBoolean()) { if (in.readBoolean()) {
boundaryChars(in.readString().toCharArray()); boundaryChars(in.readString().toCharArray());
} }
if (in.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_4_0)) {
if (in.readBoolean()) { if (in.readBoolean()) {
boundaryScannerLocale(in.readString()); boundaryScannerLocale(in.readString());
} }
@ -167,7 +167,7 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
out.writeOptionalWriteable(order); out.writeOptionalWriteable(order);
out.writeOptionalBoolean(highlightFilter); out.writeOptionalBoolean(highlightFilter);
out.writeOptionalBoolean(forceSource); out.writeOptionalBoolean(forceSource);
if (out.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_4_0)) {
out.writeOptionalWriteable(boundaryScannerType); out.writeOptionalWriteable(boundaryScannerType);
} }
out.writeOptionalVInt(boundaryMaxScan); out.writeOptionalVInt(boundaryMaxScan);
@ -176,7 +176,7 @@ public abstract class AbstractHighlighterBuilder<HB extends AbstractHighlighterB
if (hasBounaryChars) { if (hasBounaryChars) {
out.writeString(String.valueOf(boundaryChars)); out.writeString(String.valueOf(boundaryChars));
} }
if (out.getVersion().onOrAfter(Version.V_5_4_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_4_0)) {
boolean hasBoundaryScannerLocale = boundaryScannerLocale != null; boolean hasBoundaryScannerLocale = boundaryScannerLocale != null;
out.writeBoolean(hasBoundaryScannerLocale); out.writeBoolean(hasBoundaryScannerLocale);
if (hasBoundaryScannerLocale) { if (hasBoundaryScannerLocale) {

View File

@ -54,7 +54,7 @@ public final class AliasFilter implements Writeable {
public AliasFilter(StreamInput input) throws IOException { public AliasFilter(StreamInput input) throws IOException {
aliases = input.readStringArray(); aliases = input.readStringArray();
if (input.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (input.getVersion().onOrAfter(Version.V_5_1_1)) {
filter = input.readOptionalNamedWriteable(QueryBuilder.class); filter = input.readOptionalNamedWriteable(QueryBuilder.class);
reparseAliases = false; reparseAliases = false;
} else { } else {
@ -90,7 +90,7 @@ public final class AliasFilter implements Writeable {
@Override @Override
public void writeTo(StreamOutput out) throws IOException { public void writeTo(StreamOutput out) throws IOException {
out.writeStringArray(aliases); out.writeStringArray(aliases);
if (out.getVersion().onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_1_1)) {
out.writeOptionalNamedWriteable(filter); out.writeOptionalNamedWriteable(filter);
} }
} }

View File

@ -181,7 +181,7 @@ public class ShardSearchLocalRequest implements ShardSearchRequest {
source = in.readOptionalWriteable(SearchSourceBuilder::new); source = in.readOptionalWriteable(SearchSourceBuilder::new);
types = in.readStringArray(); types = in.readStringArray();
aliasFilter = new AliasFilter(in); aliasFilter = new AliasFilter(in);
if (in.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_2_0)) {
indexBoost = in.readFloat(); indexBoost = in.readFloat();
} else { } else {
// Nodes < 5.2.0 doesn't send index boost. Read it from source. // Nodes < 5.2.0 doesn't send index boost. Read it from source.
@ -209,7 +209,7 @@ public class ShardSearchLocalRequest implements ShardSearchRequest {
out.writeOptionalWriteable(source); out.writeOptionalWriteable(source);
out.writeStringArray(types); out.writeStringArray(types);
aliasFilter.writeTo(out); aliasFilter.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (out.getVersion().onOrAfter(Version.V_5_2_0)) {
out.writeFloat(indexBoost); out.writeFloat(indexBoost);
} }
if (!asKey) { if (!asKey) {

View File

@ -69,7 +69,7 @@ public final class SnapshotInfo implements Comparable<SnapshotInfo>, ToXContent,
private static final String TOTAL_SHARDS = "total_shards"; private static final String TOTAL_SHARDS = "total_shards";
private static final String SUCCESSFUL_SHARDS = "successful_shards"; private static final String SUCCESSFUL_SHARDS = "successful_shards";
private static final Version VERSION_INCOMPATIBLE_INTRODUCED = Version.V_5_2_0_UNRELEASED; private static final Version VERSION_INCOMPATIBLE_INTRODUCED = Version.V_5_2_0;
public static final Version VERBOSE_INTRODUCED = Version.V_5_5_0_UNRELEASED; public static final Version VERBOSE_INTRODUCED = Version.V_5_5_0_UNRELEASED;
private static final Comparator<SnapshotInfo> COMPARATOR = private static final Comparator<SnapshotInfo> COMPARATOR =

View File

@ -1324,9 +1324,15 @@ public abstract class TcpTransport<Channel> extends AbstractLifecycleComponent i
} }
streamIn = compressor.streamInput(streamIn); streamIn = compressor.streamInput(streamIn);
} }
if (version.isCompatible(getCurrentVersion()) == false) { // for handshakes we are compatible with N-2 since otherwise we can't figure out our initial version
// since we are compatible with N-1 and N+1 so we always send our minCompatVersion as the initial version in the
// handshake. This looks odd but it's required to establish the connection correctly we check for real compatibility
// once the connection is established
final Version compatibilityVersion = TransportStatus.isHandshake(status) ? getCurrentVersion().minimumCompatibilityVersion()
: getCurrentVersion();
if (version.isCompatible(compatibilityVersion) == false) {
throw new IllegalStateException("Received message from unsupported version: [" + version throw new IllegalStateException("Received message from unsupported version: [" + version
+ "] minimal compatible version is: [" + getCurrentVersion().minimumCompatibilityVersion() + "]"); + "] minimal compatible version is: [" + compatibilityVersion.minimumCompatibilityVersion() + "]");
} }
streamIn = new NamedWriteableAwareStreamInput(streamIn, namedWriteableRegistry); streamIn = new NamedWriteableAwareStreamInput(streamIn, namedWriteableRegistry);
streamIn.setVersion(version); streamIn.setVersion(version);

View File

@ -972,7 +972,7 @@ public class ExceptionSerializationTests extends ESTestCase {
try (StreamInput in = decoded.streamInput()) { try (StreamInput in = decoded.streamInput()) {
//randomize the version across released and unreleased ones //randomize the version across released and unreleased ones
Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
in.setVersion(version); in.setVersion(version);
ElasticsearchException exception = new ElasticsearchException(in); ElasticsearchException exception = new ElasticsearchException(in);
assertEquals("test message", exception.getMessage()); assertEquals("test message", exception.getMessage());

View File

@ -33,7 +33,7 @@ import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static org.elasticsearch.Version.V_5_3_0_UNRELEASED; import static org.elasticsearch.Version.V_5_3_0;
import static org.elasticsearch.Version.V_6_0_0_alpha2_UNRELEASED; import static org.elasticsearch.Version.V_6_0_0_alpha2_UNRELEASED;
import static org.elasticsearch.test.VersionUtils.randomVersion; import static org.elasticsearch.test.VersionUtils.randomVersion;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
@ -46,30 +46,30 @@ import static org.hamcrest.Matchers.sameInstance;
public class VersionTests extends ESTestCase { public class VersionTests extends ESTestCase {
public void testVersionComparison() throws Exception { public void testVersionComparison() throws Exception {
assertThat(V_5_3_0_UNRELEASED.before(V_6_0_0_alpha2_UNRELEASED), is(true)); assertThat(V_5_3_0.before(V_6_0_0_alpha2_UNRELEASED), is(true));
assertThat(V_5_3_0_UNRELEASED.before(V_5_3_0_UNRELEASED), is(false)); assertThat(V_5_3_0.before(V_5_3_0), is(false));
assertThat(V_6_0_0_alpha2_UNRELEASED.before(V_5_3_0_UNRELEASED), is(false)); assertThat(V_6_0_0_alpha2_UNRELEASED.before(V_5_3_0), is(false));
assertThat(V_5_3_0_UNRELEASED.onOrBefore(V_6_0_0_alpha2_UNRELEASED), is(true)); assertThat(V_5_3_0.onOrBefore(V_6_0_0_alpha2_UNRELEASED), is(true));
assertThat(V_5_3_0_UNRELEASED.onOrBefore(V_5_3_0_UNRELEASED), is(true)); assertThat(V_5_3_0.onOrBefore(V_5_3_0), is(true));
assertThat(V_6_0_0_alpha2_UNRELEASED.onOrBefore(V_5_3_0_UNRELEASED), is(false)); assertThat(V_6_0_0_alpha2_UNRELEASED.onOrBefore(V_5_3_0), is(false));
assertThat(V_5_3_0_UNRELEASED.after(V_6_0_0_alpha2_UNRELEASED), is(false)); assertThat(V_5_3_0.after(V_6_0_0_alpha2_UNRELEASED), is(false));
assertThat(V_5_3_0_UNRELEASED.after(V_5_3_0_UNRELEASED), is(false)); assertThat(V_5_3_0.after(V_5_3_0), is(false));
assertThat(V_6_0_0_alpha2_UNRELEASED.after(V_5_3_0_UNRELEASED), is(true)); assertThat(V_6_0_0_alpha2_UNRELEASED.after(V_5_3_0), is(true));
assertThat(V_5_3_0_UNRELEASED.onOrAfter(V_6_0_0_alpha2_UNRELEASED), is(false)); assertThat(V_5_3_0.onOrAfter(V_6_0_0_alpha2_UNRELEASED), is(false));
assertThat(V_5_3_0_UNRELEASED.onOrAfter(V_5_3_0_UNRELEASED), is(true)); assertThat(V_5_3_0.onOrAfter(V_5_3_0), is(true));
assertThat(V_6_0_0_alpha2_UNRELEASED.onOrAfter(V_5_3_0_UNRELEASED), is(true)); assertThat(V_6_0_0_alpha2_UNRELEASED.onOrAfter(V_5_3_0), is(true));
assertTrue(Version.fromString("5.0.0-alpha2").onOrAfter(Version.fromString("5.0.0-alpha1"))); assertTrue(Version.fromString("5.0.0-alpha2").onOrAfter(Version.fromString("5.0.0-alpha1")));
assertTrue(Version.fromString("5.0.0").onOrAfter(Version.fromString("5.0.0-beta2"))); assertTrue(Version.fromString("5.0.0").onOrAfter(Version.fromString("5.0.0-beta2")));
assertTrue(Version.fromString("5.0.0-rc1").onOrAfter(Version.fromString("5.0.0-beta24"))); assertTrue(Version.fromString("5.0.0-rc1").onOrAfter(Version.fromString("5.0.0-beta24")));
assertTrue(Version.fromString("5.0.0-alpha24").before(Version.fromString("5.0.0-beta0"))); assertTrue(Version.fromString("5.0.0-alpha24").before(Version.fromString("5.0.0-beta0")));
assertThat(V_5_3_0_UNRELEASED, is(lessThan(V_6_0_0_alpha2_UNRELEASED))); assertThat(V_5_3_0, is(lessThan(V_6_0_0_alpha2_UNRELEASED)));
assertThat(V_5_3_0_UNRELEASED.compareTo(V_5_3_0_UNRELEASED), is(0)); assertThat(V_5_3_0.compareTo(V_5_3_0), is(0));
assertThat(V_6_0_0_alpha2_UNRELEASED, is(greaterThan(V_5_3_0_UNRELEASED))); assertThat(V_6_0_0_alpha2_UNRELEASED, is(greaterThan(V_5_3_0)));
} }
public void testMin() { public void testMin() {
@ -100,7 +100,7 @@ public class VersionTests extends ESTestCase {
assertEquals(Version.V_5_0_0, Version.V_6_0_0_alpha2_UNRELEASED.minimumIndexCompatibilityVersion()); assertEquals(Version.V_5_0_0, Version.V_6_0_0_alpha2_UNRELEASED.minimumIndexCompatibilityVersion());
assertEquals(Version.fromId(2000099), Version.V_5_0_0.minimumIndexCompatibilityVersion()); assertEquals(Version.fromId(2000099), Version.V_5_0_0.minimumIndexCompatibilityVersion());
assertEquals(Version.fromId(2000099), assertEquals(Version.fromId(2000099),
Version.V_5_1_1_UNRELEASED.minimumIndexCompatibilityVersion()); Version.V_5_1_1.minimumIndexCompatibilityVersion());
assertEquals(Version.fromId(2000099), assertEquals(Version.fromId(2000099),
Version.V_5_0_0_alpha1.minimumIndexCompatibilityVersion()); Version.V_5_0_0_alpha1.minimumIndexCompatibilityVersion());
} }
@ -157,7 +157,7 @@ public class VersionTests extends ESTestCase {
public void testIndexCreatedVersion() { public void testIndexCreatedVersion() {
// an actual index has a IndexMetaData.SETTING_INDEX_UUID // an actual index has a IndexMetaData.SETTING_INDEX_UUID
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_2,
Version.V_5_2_0_UNRELEASED, Version.V_6_0_0_alpha2_UNRELEASED); Version.V_5_2_0, Version.V_6_0_0_alpha2_UNRELEASED);
assertEquals(version, Version.indexCreated(Settings.builder().put(IndexMetaData.SETTING_INDEX_UUID, "foo").put(IndexMetaData.SETTING_VERSION_CREATED, version).build())); assertEquals(version, Version.indexCreated(Settings.builder().put(IndexMetaData.SETTING_INDEX_UUID, "foo").put(IndexMetaData.SETTING_VERSION_CREATED, version).build()));
} }
@ -311,8 +311,8 @@ public class VersionTests extends ESTestCase {
} }
if (other.isAlpha() == false && version.isAlpha() == false if (other.isAlpha() == false && version.isAlpha() == false
&& other.major == version.major && other.minor == version.minor) { && other.major == version.major && other.minor == version.minor) {
assertEquals(other.luceneVersion.major, version.luceneVersion.major); assertEquals(version + " vs. " + other, other.luceneVersion.major, version.luceneVersion.major);
assertEquals(other.luceneVersion.minor, version.luceneVersion.minor); assertEquals(version + " vs. " + other, other.luceneVersion.minor, version.luceneVersion.minor);
// should we also assert the lucene bugfix version? // should we also assert the lucene bugfix version?
} }
} }
@ -326,11 +326,12 @@ public class VersionTests extends ESTestCase {
public void testIsCompatible() { public void testIsCompatible() {
assertTrue(isCompatible(Version.CURRENT, Version.CURRENT.minimumCompatibilityVersion())); assertTrue(isCompatible(Version.CURRENT, Version.CURRENT.minimumCompatibilityVersion()));
assertTrue(isCompatible(Version.V_5_0_0, Version.V_6_0_0_alpha2_UNRELEASED)); assertTrue(isCompatible(Version.V_5_5_0_UNRELEASED, Version.V_6_0_0_alpha2_UNRELEASED));
assertFalse(isCompatible(Version.fromId(2000099), Version.V_6_0_0_alpha2_UNRELEASED)); assertFalse(isCompatible(Version.fromId(2000099), Version.V_6_0_0_alpha2_UNRELEASED));
assertFalse(isCompatible(Version.fromId(2000099), Version.V_5_0_0)); assertFalse(isCompatible(Version.fromId(2000099), Version.V_5_0_0));
} }
public boolean isCompatible(Version left, Version right) { public boolean isCompatible(Version left, Version right) {
boolean result = left.isCompatible(right); boolean result = left.isCompatible(right);
assert result == right.isCompatible(left); assert result == right.isCompatible(left);

View File

@ -93,7 +93,7 @@ public class ClusterSearchShardsResponseTests extends ESTestCase {
assertEquals(clusterSearchShardsGroup.getShardId(), deserializedGroup.getShardId()); assertEquals(clusterSearchShardsGroup.getShardId(), deserializedGroup.getShardId());
assertArrayEquals(clusterSearchShardsGroup.getShards(), deserializedGroup.getShards()); assertArrayEquals(clusterSearchShardsGroup.getShards(), deserializedGroup.getShards());
} }
if (version.onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (version.onOrAfter(Version.V_5_1_1)) {
assertEquals(clusterSearchShardsResponse.getIndicesAndFilters(), deserialized.getIndicesAndFilters()); assertEquals(clusterSearchShardsResponse.getIndicesAndFilters(), deserialized.getIndicesAndFilters());
} else { } else {
assertNull(deserialized.getIndicesAndFilters()); assertNull(deserialized.getIndicesAndFilters());

View File

@ -51,7 +51,7 @@ public class PutStoredScriptRequestTests extends ESTestCase {
public void testSerializationBwc() throws IOException { public void testSerializationBwc() throws IOException {
final byte[] rawStreamBytes = Base64.getDecoder().decode("ADwDCG11c3RhY2hlAQZzY3JpcHQCe30A"); final byte[] rawStreamBytes = Base64.getDecoder().decode("ADwDCG11c3RhY2hlAQZzY3JpcHQCe30A");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(rawStreamBytes)) { try (StreamInput in = StreamInput.wrap(rawStreamBytes)) {
in.setVersion(version); in.setVersion(version);
PutStoredScriptRequest serialized = new PutStoredScriptRequest(); PutStoredScriptRequest serialized = new PutStoredScriptRequest();

View File

@ -51,8 +51,8 @@ public class CreateIndexRequestTests extends ESTestCase {
public void testSerializationBwc() throws IOException { public void testSerializationBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("ADwDAANmb28APAMBB215X3R5cGULeyJ0eXBlIjp7fX0AAAD////+AA=="); final byte[] data = Base64.getDecoder().decode("ADwDAANmb28APAMBB215X3R5cGULeyJ0eXBlIjp7fX0AAAD////+AA==");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, Version.V_5_1_1, Version.V_5_1_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
CreateIndexRequest serialized = new CreateIndexRequest(); CreateIndexRequest serialized = new CreateIndexRequest();

View File

@ -94,7 +94,7 @@ public class PutMappingRequestTests extends ESTestCase {
public void testSerializationBwc() throws IOException { public void testSerializationBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("ADwDAQNmb28MAA8tLS0KZm9vOiAiYmFyIgoAPAMAAAA="); final byte[] data = Base64.getDecoder().decode("ADwDAQNmb28MAA8tLS0KZm9vOiAiYmFyIgoAPAMAAAA=");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
PutMappingRequest request = new PutMappingRequest(); PutMappingRequest request = new PutMappingRequest();

View File

@ -89,7 +89,7 @@ public class PutIndexTemplateRequestTests extends ESTestCase {
public void testPutIndexTemplateRequestSerializationXContentBwc() throws IOException { public void testPutIndexTemplateRequestSerializationXContentBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("ADwDAANmb28IdGVtcGxhdGUAAAAAAAABA2Jhcg8tLS0KZm9vOiAiYmFyIgoAAAAAAAAAAAAAAAA="); final byte[] data = Base64.getDecoder().decode("ADwDAANmb28IdGVtcGxhdGUAAAAAAAABA2Jhcg8tLS0KZm9vOiAiYmFyIgoAAAAAAAAAAAAAAAA=");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
PutIndexTemplateRequest request = new PutIndexTemplateRequest(); PutIndexTemplateRequest request = new PutIndexTemplateRequest();

View File

@ -113,7 +113,7 @@ public class FieldStatsRequestTests extends ESTestCase {
FieldStatsShardResponse deserialized = new FieldStatsShardResponse(); FieldStatsShardResponse deserialized = new FieldStatsShardResponse();
deserialized.readFrom(input); deserialized.readFrom(input);
final Map<String, FieldStats<?>> expected; final Map<String, FieldStats<?>> expected;
if (version.before(Version.V_5_2_0_UNRELEASED)) { if (version.before(Version.V_5_2_0)) {
expected = deserialized.filterNullMinMax(); expected = deserialized.filterNullMinMax();
} else { } else {
expected = deserialized.getFieldStats(); expected = deserialized.getFieldStats();

View File

@ -178,7 +178,7 @@ public class IndexRequestTests extends ESTestCase {
public void testIndexRequestXContentSerializationBwc() throws IOException { public void testIndexRequestXContentSerializationBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("AAD////+AgQDZm9vAAAAAQNiYXIBATEAAAAAAnt9AP/////////9AAAA//////////8AAAAAAAA="); final byte[] data = Base64.getDecoder().decode("AAD////+AgQDZm9vAAAAAQNiYXIBATEAAAAAAnt9AP/////////9AAAA//////////8AAAAAAAA=");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
IndexRequest serialized = new IndexRequest(); IndexRequest serialized = new IndexRequest();

View File

@ -49,7 +49,7 @@ public class PutPipelineRequestTests extends ESTestCase {
public void testSerializationBwc() throws IOException { public void testSerializationBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("ADwDATECe30="); final byte[] data = Base64.getDecoder().decode("ADwDATECe30=");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
PutPipelineRequest request = new PutPipelineRequest(); PutPipelineRequest request = new PutPipelineRequest();

View File

@ -74,7 +74,7 @@ public class SimulatePipelineRequestTests extends ESTestCase {
public void testSerializationWithXContentBwc() throws IOException { public void testSerializationWithXContentBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("AAAAAnt9AAA="); final byte[] data = Base64.getDecoder().decode("AAAAAnt9AAA=");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
SimulatePipelineRequest request = new SimulatePipelineRequest(); SimulatePipelineRequest request = new SimulatePipelineRequest();

View File

@ -269,7 +269,7 @@ public class TermVectorsUnitTests extends ESTestCase {
public void testStreamRequestWithXContentBwc() throws IOException { public void testStreamRequestWithXContentBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("AAABBWluZGV4BHR5cGUCaWQBAnt9AAABDnNvbWVQcmVmZXJlbmNlFgAAAAEA//////////0AAAA="); final byte[] data = Base64.getDecoder().decode("AAABBWluZGV4BHR5cGUCaWQBAnt9AAABDnNvbWVQcmVmZXJlbmNlFgAAAAEA//////////0AAAA=");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
TermVectorsRequest request = new TermVectorsRequest(); TermVectorsRequest request = new TermVectorsRequest();

View File

@ -76,8 +76,10 @@ public class DiscoveryNodeTests extends ESTestCase {
assertEquals(transportAddress.getAddress(), serialized.getHostAddress()); assertEquals(transportAddress.getAddress(), serialized.getHostAddress());
assertEquals(transportAddress.getAddress(), serialized.getAddress().getAddress()); assertEquals(transportAddress.getAddress(), serialized.getAddress().getAddress());
assertEquals(transportAddress.getPort(), serialized.getAddress().getPort()); assertEquals(transportAddress.getPort(), serialized.getAddress().getPort());
assertFalse("if the minimum compatibility version moves past 5.0.3, remove the special casing in DiscoverNode(StreamInput) and " + assertFalse("if the minimum index compatibility version moves past 5.0.3, remove the special casing in DiscoverNode(StreamInput)" +
"the TransportAddress(StreamInput, String) constructor", " and the TransportAddress(StreamInput, String) constructor",
Version.CURRENT.minimumCompatibilityVersion().onOrAfter(Version.V_5_0_3_UNRELEASED)); Version.CURRENT.minimumIndexCompatibilityVersion().after(Version.V_5_0_2));
// serialization can happen from an old cluster-state in a full cluster restart
// hence we need to maintain this until we drop index bwc
} }
} }

View File

@ -139,7 +139,7 @@ public class ClusterSerializationTests extends ESAllocationTestCase {
// serialize with old version // serialize with old version
outStream = new BytesStreamOutput(); outStream = new BytesStreamOutput();
outStream.setVersion(Version.CURRENT.minimumCompatibilityVersion()); outStream.setVersion(Version.CURRENT.minimumIndexCompatibilityVersion());
diffs.writeTo(outStream); diffs.writeTo(outStream);
inStream = outStream.bytes().streamInput(); inStream = outStream.bytes().streamInput();
inStream = new NamedWriteableAwareStreamInput(inStream, new NamedWriteableRegistry(ClusterModule.getNamedWriteables())); inStream = new NamedWriteableAwareStreamInput(inStream, new NamedWriteableRegistry(ClusterModule.getNamedWriteables()));

View File

@ -805,7 +805,7 @@ public class BytesStreamsTests extends ESTestCase {
} }
assertTrue("If we're not compatible with 5.1.1 we can drop the assertion below", assertTrue("If we're not compatible with 5.1.1 we can drop the assertion below",
Version.CURRENT.minimumCompatibilityVersion().onOrBefore(Version.V_5_1_1_UNRELEASED)); Version.CURRENT.minimumIndexCompatibilityVersion().onOrBefore(Version.V_5_1_1));
/* Read -1 as serialized by a version of Elasticsearch that supported writing negative numbers with writeVLong. Note that this /* Read -1 as serialized by a version of Elasticsearch that supported writing negative numbers with writeVLong. Note that this
* should be the same test as the first case (when value is negative) but we've kept some bytes so no matter what we do to * should be the same test as the first case (when value is negative) but we've kept some bytes so no matter what we do to
* writeVLong in the future we can be sure we can read bytes as written by Elasticsearch before 5.1.2 */ * writeVLong in the future we can be sure we can read bytes as written by Elasticsearch before 5.1.2 */

View File

@ -361,8 +361,8 @@ public class ZenDiscoveryUnitTests extends ESTestCase {
IllegalStateException ex = expectThrows(IllegalStateException.class, () -> IllegalStateException ex = expectThrows(IllegalStateException.class, () ->
request.messageReceived(new MembershipAction.ValidateJoinRequest(stateBuilder.build()), null)); request.messageReceived(new MembershipAction.ValidateJoinRequest(stateBuilder.build()), null));
assertEquals("index [test] version not supported: " assertEquals("index [test] version not supported: "
+ VersionUtils.getPreviousVersion(Version.CURRENT.minimumCompatibilityVersion()) + VersionUtils.getPreviousVersion(Version.CURRENT.minimumIndexCompatibilityVersion())
+ " minimum compatible index version is: " + Version.CURRENT.minimumCompatibilityVersion(), ex.getMessage()); + " minimum compatible index version is: " + Version.CURRENT.minimumIndexCompatibilityVersion(), ex.getMessage());
} else { } else {
AtomicBoolean sendResponse = new AtomicBoolean(false); AtomicBoolean sendResponse = new AtomicBoolean(false);
request.messageReceived(new MembershipAction.ValidateJoinRequest(stateBuilder.build()), new TransportChannel() { request.messageReceived(new MembershipAction.ValidateJoinRequest(stateBuilder.build()), new TransportChannel() {

View File

@ -606,7 +606,7 @@ public class FieldStatsTests extends ESSingleNodeTestCase {
public void testSerialization() throws IOException { public void testSerialization() throws IOException {
for (Version version : new Version[] {Version.CURRENT, Version.V_5_0_1}){ for (Version version : new Version[] {Version.CURRENT, Version.V_5_0_1}){
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
assertSerialization(randomFieldStats(version.onOrAfter(Version.V_5_2_0_UNRELEASED)), version); assertSerialization(randomFieldStats(version.onOrAfter(Version.V_5_2_0)), version);
} }
} }
} }

View File

@ -152,7 +152,7 @@ public class IndexSortSettingsTests extends ESTestCase {
.put("index.sort.field", "field1") .put("index.sort.field", "field1")
.build(); .build();
IllegalArgumentException exc = IllegalArgumentException exc =
expectThrows(IllegalArgumentException.class, () -> indexSettings(settings, Version.V_5_4_0_UNRELEASED)); expectThrows(IllegalArgumentException.class, () -> indexSettings(settings, Version.V_5_4_0));
assertThat(exc.getMessage(), assertThat(exc.getMessage(),
containsString("unsupported index.version.created:5.4.0, " + containsString("unsupported index.version.created:5.4.0, " +
"can't set index.sort on versions prior to 6.0.0-alpha1")); "can't set index.sort on versions prior to 6.0.0-alpha1"));

View File

@ -63,8 +63,8 @@ public class PreBuiltAnalyzerTests extends ESSingleNodeTestCase {
assertSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.CURRENT), assertSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.CURRENT),
PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.CURRENT)); PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.CURRENT));
// same lucene version should be cached // same lucene version should be cached
assertSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_5_2_2_UNRELEASED), assertSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_5_2_1),
PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_5_2_3_UNRELEASED)); PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_5_2_2));
assertNotSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_5_0_0), assertNotSame(PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_5_0_0),
PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_5_0_1)); PreBuiltAnalyzers.ARABIC.getAnalyzer(Version.V_5_0_1));

View File

@ -1486,7 +1486,7 @@ public class InternalEngineTests extends ESTestCase {
IndexSettings oldSettings = IndexSettingsModule.newIndexSettings("testOld", Settings.builder() IndexSettings oldSettings = IndexSettingsModule.newIndexSettings("testOld", Settings.builder()
.put(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), "1h") // make sure this doesn't kick in on us .put(IndexSettings.INDEX_GC_DELETES_SETTING.getKey(), "1h") // make sure this doesn't kick in on us
.put(EngineConfig.INDEX_CODEC_SETTING.getKey(), codecName) .put(EngineConfig.INDEX_CODEC_SETTING.getKey(), codecName)
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_5_4_0_UNRELEASED) .put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_5_4_0)
.put(MapperService.INDEX_MAPPING_SINGLE_TYPE_SETTING.getKey(), true) .put(MapperService.INDEX_MAPPING_SINGLE_TYPE_SETTING.getKey(), true)
.put(IndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD.getKey(), .put(IndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD.getKey(),
between(10, 10 * IndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD.get(Settings.EMPTY))) between(10, 10 * IndexSettings.MAX_REFRESH_LISTENERS_PER_SHARD.get(Settings.EMPTY)))

View File

@ -56,7 +56,7 @@ public class MapperTests extends ESTestCase {
"As a replacement, you can use an [copy_to] on mapping fields to create your own catch all field.", "As a replacement, you can use an [copy_to] on mapping fields to create your own catch all field.",
e.getMessage()); e.getMessage());
settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_5_3_0_UNRELEASED).build(); settings = Settings.builder().put(IndexMetaData.SETTING_VERSION_CREATED, Version.V_5_3_0).build();
// Create the mapping service with an older index creation version // Create the mapping service with an older index creation version
final MapperService oldMapperService = MapperTestUtils.newMapperService(xContentRegistry(), createTempDir(), settings, "test"); final MapperService oldMapperService = MapperTestUtils.newMapperService(xContentRegistry(), createTempDir(), settings, "test");

View File

@ -336,7 +336,7 @@ public class MoreLikeThisQueryBuilderTests extends AbstractQueryTestCase<MoreLik
public void testItemSerializationBwc() throws IOException { public void testItemSerializationBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("AQVpbmRleAEEdHlwZQEODXsiZm9vIjoiYmFyIn0A/wD//////////QAAAAAAAAAA"); final byte[] data = Base64.getDecoder().decode("AQVpbmRleAEEdHlwZQEODXsiZm9vIjoiYmFyIn0A/wD//////////QAAAAAAAAAA");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
Item item = new Item(in); Item item = new Item(in);

View File

@ -34,15 +34,4 @@ public class RefreshStatsTests extends AbstractStreamableTestCase<RefreshStats>
protected RefreshStats createBlankInstance() { protected RefreshStats createBlankInstance() {
return new RefreshStats(); return new RefreshStats();
} }
public void testPre5Dot2() throws IOException {
// We can drop the compatibility once the assertion just below this list fails
assertTrue(Version.CURRENT.minimumCompatibilityVersion().before(Version.V_5_2_0_UNRELEASED));
RefreshStats instance = createTestInstance();
RefreshStats copied = copyInstance(instance, Version.V_5_1_1_UNRELEASED);
assertEquals(instance.getTotal(), copied.getTotal());
assertEquals(instance.getTotalTimeInMillis(), copied.getTotalTimeInMillis());
assertEquals(0, copied.getListeners());
}
} }

View File

@ -75,7 +75,7 @@ public class BulkByScrollTaskStatusTests extends ESTestCase {
assertEquals(expected.getRequestsPerSecond(), actual.getRequestsPerSecond(), 0f); assertEquals(expected.getRequestsPerSecond(), actual.getRequestsPerSecond(), 0f);
assertEquals(expected.getReasonCancelled(), actual.getReasonCancelled()); assertEquals(expected.getReasonCancelled(), actual.getReasonCancelled());
assertEquals(expected.getThrottledUntil(), actual.getThrottledUntil()); assertEquals(expected.getThrottledUntil(), actual.getThrottledUntil());
if (version.onOrAfter(Version.V_5_1_1_UNRELEASED)) { if (version.onOrAfter(Version.V_5_1_1)) {
assertThat(actual.getSliceStatuses(), Matchers.hasSize(expected.getSliceStatuses().size())); assertThat(actual.getSliceStatuses(), Matchers.hasSize(expected.getSliceStatuses().size()));
for (int i = 0; i < expected.getSliceStatuses().size(); i++) { for (int i = 0; i < expected.getSliceStatuses().size(); i++) {
BulkByScrollTask.StatusOrException sliceStatus = expected.getSliceStatuses().get(i); BulkByScrollTask.StatusOrException sliceStatus = expected.getSliceStatuses().get(i);

View File

@ -54,9 +54,9 @@ public class PipelineConfigurationTests extends ESTestCase {
public void testSerializationBwc() throws IOException { public void testSerializationBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("ATECe30AAAA="); final byte[] data = Base64.getDecoder().decode("ATECe30AAAA=");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
in.setVersion(version); in.setVersion(version);
PipelineConfiguration configuration = PipelineConfiguration.readFrom(in); PipelineConfiguration configuration = PipelineConfiguration.readFrom(in);
assertEquals(XContentType.JSON, configuration.getXContentType()); assertEquals(XContentType.JSON, configuration.getXContentType());

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -184,7 +184,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
} }
document = in.readOptionalBytesReference(); document = in.readOptionalBytesReference();
if (document != null) { if (document != null) {
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (in.getVersion().onOrAfter(Version.V_5_3_0)) {
documentXContentType = XContentType.readFrom(in); documentXContentType = XContentType.readFrom(in);
} else { } else {
documentXContentType = XContentFactory.xContentType(document); documentXContentType = XContentFactory.xContentType(document);
@ -210,7 +210,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
out.writeBoolean(false); out.writeBoolean(false);
} }
out.writeOptionalBytesReference(document); out.writeOptionalBytesReference(document);
if (document != null && out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) { if (document != null && out.getVersion().onOrAfter(Version.V_5_3_0)) {
documentXContentType.writeTo(out); documentXContentType.writeTo(out);
} }
} }

View File

@ -250,7 +250,7 @@ public class PercolateQueryBuilderTests extends AbstractQueryTestCase<PercolateQ
public void testSerializationBwc() throws IOException { public void testSerializationBwc() throws IOException {
final byte[] data = Base64.getDecoder().decode("P4AAAAAFZmllbGQEdHlwZQAAAAAAAA57ImZvbyI6ImJhciJ9AAAAAA=="); final byte[] data = Base64.getDecoder().decode("P4AAAAAFZmllbGQEdHlwZQAAAAAAAA57ImZvbyI6ImJhciJ9AAAAAA==");
final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2, final Version version = randomFrom(Version.V_5_0_0, Version.V_5_0_1, Version.V_5_0_2,
Version.V_5_0_3_UNRELEASED, Version.V_5_1_1_UNRELEASED, Version.V_5_1_2_UNRELEASED, Version.V_5_2_0_UNRELEASED); Version.V_5_1_1, Version.V_5_1_2, Version.V_5_2_0);
try (StreamInput in = StreamInput.wrap(data)) { try (StreamInput in = StreamInput.wrap(data)) {
in.setVersion(version); in.setVersion(version);
PercolateQueryBuilder queryBuilder = new PercolateQueryBuilder(in); PercolateQueryBuilder queryBuilder = new PercolateQueryBuilder(in);

View File

@ -159,7 +159,7 @@ public class RoundTripTests extends ESTestCase {
assertEquals(request.getRemoteInfo().getUsername(), tripped.getRemoteInfo().getUsername()); assertEquals(request.getRemoteInfo().getUsername(), tripped.getRemoteInfo().getUsername());
assertEquals(request.getRemoteInfo().getPassword(), tripped.getRemoteInfo().getPassword()); assertEquals(request.getRemoteInfo().getPassword(), tripped.getRemoteInfo().getPassword());
assertEquals(request.getRemoteInfo().getHeaders(), tripped.getRemoteInfo().getHeaders()); assertEquals(request.getRemoteInfo().getHeaders(), tripped.getRemoteInfo().getHeaders());
if (version.onOrAfter(Version.V_5_2_0_UNRELEASED)) { if (version.onOrAfter(Version.V_5_2_0)) {
assertEquals(request.getRemoteInfo().getSocketTimeout(), tripped.getRemoteInfo().getSocketTimeout()); assertEquals(request.getRemoteInfo().getSocketTimeout(), tripped.getRemoteInfo().getSocketTimeout());
assertEquals(request.getRemoteInfo().getConnectTimeout(), tripped.getRemoteInfo().getConnectTimeout()); assertEquals(request.getRemoteInfo().getConnectTimeout(), tripped.getRemoteInfo().getConnectTimeout());
} else { } else {

View File

@ -140,7 +140,7 @@ public class ClientYamlTestSectionTests extends AbstractClientYamlTestFragmentPa
assertThat(testSection.getSkipSection(), notNullValue()); assertThat(testSection.getSkipSection(), notNullValue());
assertThat(testSection.getSkipSection().getLowerVersion(), equalTo(Version.V_5_0_0)); assertThat(testSection.getSkipSection().getLowerVersion(), equalTo(Version.V_5_0_0));
assertThat(testSection.getSkipSection().getUpperVersion(), assertThat(testSection.getSkipSection().getUpperVersion(),
equalTo(Version.V_5_2_0_UNRELEASED)); equalTo(Version.V_5_2_0));
assertThat(testSection.getSkipSection().getReason(), equalTo("Update doesn't return metadata fields, waiting for #3259")); assertThat(testSection.getSkipSection().getReason(), equalTo("Update doesn't return metadata fields, waiting for #3259"));
assertThat(testSection.getExecutableSections().size(), equalTo(2)); assertThat(testSection.getExecutableSections().size(), equalTo(2));
DoSection doSection = (DoSection)testSection.getExecutableSections().get(0); DoSection doSection = (DoSection)testSection.getExecutableSections().get(0);

View File

@ -76,7 +76,7 @@ public class SetupSectionTests extends AbstractClientYamlTestFragmentParserTestC
assertThat(setupSection.getSkipSection(), notNullValue()); assertThat(setupSection.getSkipSection(), notNullValue());
assertThat(setupSection.getSkipSection().getLowerVersion(), equalTo(Version.V_5_0_0)); assertThat(setupSection.getSkipSection().getLowerVersion(), equalTo(Version.V_5_0_0));
assertThat(setupSection.getSkipSection().getUpperVersion(), assertThat(setupSection.getSkipSection().getUpperVersion(),
equalTo(Version.V_5_3_0_UNRELEASED)); equalTo(Version.V_5_3_0));
assertThat(setupSection.getSkipSection().getReason(), equalTo("Update doesn't return metadata fields, waiting for #3259")); assertThat(setupSection.getSkipSection().getReason(), equalTo("Update doesn't return metadata fields, waiting for #3259"));
assertThat(setupSection.getDoSections().size(), equalTo(2)); assertThat(setupSection.getDoSections().size(), equalTo(2));
assertThat(setupSection.getDoSections().get(0).getApiCallSection().getApi(), equalTo("index1")); assertThat(setupSection.getDoSections().get(0).getApiCallSection().getApi(), equalTo("index1"));

View File

@ -62,7 +62,7 @@ public class SkipSectionTests extends AbstractClientYamlTestFragmentParserTestCa
SkipSection skipSection = SkipSection.parse(parser); SkipSection skipSection = SkipSection.parse(parser);
assertThat(skipSection, notNullValue()); assertThat(skipSection, notNullValue());
assertThat(skipSection.getLowerVersion(), equalTo(VersionUtils.getFirstVersion())); assertThat(skipSection.getLowerVersion(), equalTo(VersionUtils.getFirstVersion()));
assertThat(skipSection.getUpperVersion(), equalTo(Version.V_5_1_1_UNRELEASED)); assertThat(skipSection.getUpperVersion(), equalTo(Version.V_5_1_1));
assertThat(skipSection.getFeatures().size(), equalTo(0)); assertThat(skipSection.getFeatures().size(), equalTo(0));
assertThat(skipSection.getReason(), equalTo("Delete ignores the parent param")); assertThat(skipSection.getReason(), equalTo("Delete ignores the parent param"));
} }

View File

@ -76,7 +76,7 @@ public class TeardownSectionTests extends AbstractClientYamlTestFragmentParserTe
assertThat(section, notNullValue()); assertThat(section, notNullValue());
assertThat(section.getSkipSection().isEmpty(), equalTo(false)); assertThat(section.getSkipSection().isEmpty(), equalTo(false));
assertThat(section.getSkipSection().getLowerVersion(), equalTo(Version.V_5_0_0)); assertThat(section.getSkipSection().getLowerVersion(), equalTo(Version.V_5_0_0));
assertThat(section.getSkipSection().getUpperVersion(), equalTo(Version.V_5_3_0_UNRELEASED)); assertThat(section.getSkipSection().getUpperVersion(), equalTo(Version.V_5_3_0));
assertThat(section.getSkipSection().getReason(), equalTo("there is a reason")); assertThat(section.getSkipSection().getReason(), equalTo("there is a reason"));
assertThat(section.getDoSections().size(), equalTo(2)); assertThat(section.getDoSections().size(), equalTo(2));
assertThat(section.getDoSections().get(0).getApiCallSection().getApi(), equalTo("delete")); assertThat(section.getDoSections().get(0).getApiCallSection().getApi(), equalTo("delete"));