Internal: fixed bw comp in ShardSearchTransportRequest

Original indices were introduced in 1.4.0.Beta1 as optional, preceded by a boolean flag that told whether they were empty or not. We have to keep serializing as optional only when reading and writing from/to 1.4.0.Beta1, although the original indices are not optional whenever we go and serialize the request they belong to (which is why the boolean got removed in 1.4.0).
This commit is contained in:
javanna 2014-10-10 21:32:09 +02:00 committed by Luca Cavanna
parent 694cc08625
commit 142d7bdd81
1 changed files with 11 additions and 0 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.search.internal;
import org.elasticsearch.Version;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.OriginalIndices;
import org.elasticsearch.action.search.SearchRequest;
@ -163,6 +164,11 @@ public class ShardSearchTransportRequest extends TransportRequest implements Sha
super.readFrom(in);
shardSearchLocalRequest = new ShardSearchLocalRequest();
shardSearchLocalRequest.innerReadFrom(in);
if (in.getVersion().onOrAfter(Version.V_1_4_0_Beta1) && in.getVersion().before(Version.V_1_4_0)) {
//original indices used to be optional in 1.4.0.Beta1 but ended up being empty only when the
// shard search request was used locally and never serialized
in.readBoolean();
}
originalIndices = OriginalIndices.readOriginalIndices(in);
}
@ -170,6 +176,11 @@ public class ShardSearchTransportRequest extends TransportRequest implements Sha
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
shardSearchLocalRequest.innerWriteTo(out, false);
if (out.getVersion().onOrAfter(Version.V_1_4_0_Beta1) && out.getVersion().before(Version.V_1_4_0)) {
//original indices used to be optional in 1.4.0.Beta1 although ended up being empty only when the
//shard search request was used locally and never serialized
out.writeBoolean(true);
}
OriginalIndices.writeOriginalIndices(originalIndices, out);
}