Skip to content

Commit

Permalink
Adjust BWC after backporting point in time to 7.10 (#62262)
Browse files Browse the repository at this point in the history
Relates #61062
  • Loading branch information
dnhatn authored Sep 11, 2020
1 parent abde6fb commit 7b1ab6f
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 33 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ tasks.register("verifyVersions") {
* after the backport of the backcompat code is complete.
*/

boolean bwc_tests_enabled = false
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/61872"
boolean bwc_tests_enabled = true
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
if (bwc_tests_enabled == false) {
if (bwc_tests_disabled_issue.isEmpty()) {
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public SearchResponse(StreamInput in) throws IOException {
scrollId = in.readOptionalString();
tookInMillis = in.readVLong();
skippedShards = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
pointInTimeId = in.readOptionalString();
} else {
pointInTimeId = null;
Expand Down Expand Up @@ -408,7 +408,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(scrollId);
out.writeVLong(tookInMillis);
out.writeVInt(skippedShards);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
out.writeOptionalString(pointInTimeId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ public void writeTo(StreamOutput out) throws IOException {
}

static boolean keepStatesInContext(Version version) {
return version.before(Version.V_8_0_0);
return version.before(Version.V_7_10_0);
}

public static void registerRequestHandler(TransportService transportService, SearchService searchService) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ public SearchSourceBuilder(StreamInput in) throws IOException {
if (in.readBoolean()) {
fetchFields = in.readList(FieldAndFormat::new);
}
}
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
pointInTimeBuilder = in.readOptionalWriteable(PointInTimeBuilder::new);
}
}
Expand Down Expand Up @@ -313,8 +311,6 @@ public void writeTo(StreamOutput out) throws IOException {
if (fetchFields != null) {
out.writeList(fetchFields);
}
}
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeOptionalWriteable(pointInTimeBuilder);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public DfsSearchResult(StreamInput in) throws IOException {
fieldStatistics = readFieldStats(in);

maxDoc = in.readVInt();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
setShardSearchRequest(in.readOptionalWriteable(ShardSearchRequest::new));
}
}
Expand Down Expand Up @@ -115,7 +115,7 @@ public void writeTo(StreamOutput out) throws IOException {
writeTermStats(out, termStatistics);
writeFieldStats(out, fieldStatistics);
out.writeVInt(maxDoc);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
out.writeOptionalWriteable(getShardSearchRequest());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ShardFetchSearchRequest(OriginalIndices originalIndices, ShardSearchConte
public ShardFetchSearchRequest(StreamInput in) throws IOException {
super(in);
originalIndices = OriginalIndices.readOriginalIndices(in);
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
shardSearchRequest = in.readOptionalWriteable(ShardSearchRequest::new);
rescoreDocIds = new RescoreDocIds(in);
aggregatedDfs = in.readOptionalWriteable(AggregatedDfs::new);
Expand All @@ -72,7 +72,7 @@ public ShardFetchSearchRequest(StreamInput in) throws IOException {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
OriginalIndices.writeOriginalIndices(originalIndices, out);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
out.writeOptionalWriteable(shardSearchRequest);
rescoreDocIds.writeTo(out);
out.writeOptionalWriteable(aggregatedDfs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,13 @@ public ShardSearchRequest(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_7_7_0)) {
canReturnNullResponseIfMatchNoDocs = in.readBoolean();
bottomSortValues = in.readOptionalWriteable(SearchSortValuesAndFormats::new);
readerId = in.readOptionalWriteable(ShardSearchContextId::new);
keepAlive = in.readOptionalTimeValue();
} else {
canReturnNullResponseIfMatchNoDocs = false;
bottomSortValues = null;
}
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
this.readerId = in.readOptionalWriteable(ShardSearchContextId::new);
this.keepAlive = in.readOptionalTimeValue();
} else {
this.readerId = null;
this.keepAlive = null;
readerId = null;
keepAlive = null;
}
originalIndices = OriginalIndices.readOriginalIndices(in);
assert (readerId != null) == (keepAlive != null);
Expand Down Expand Up @@ -271,11 +268,9 @@ protected final void innerWriteTo(StreamOutput out, boolean asKey) throws IOExce
out.writeStringArray(indexRoutings);
out.writeOptionalString(preference);
}
if (out.getVersion().onOrAfter(Version.V_7_7_0) && asKey == false) {
if (asKey == false && out.getVersion().onOrAfter(Version.V_7_7_0)) {
out.writeBoolean(canReturnNullResponseIfMatchNoDocs);
out.writeOptionalWriteable(bottomSortValues);
}
if (out.getVersion().onOrAfter(Version.V_8_0_0) && asKey == false) {
out.writeOptionalWriteable(readerId);
out.writeOptionalTimeValue(keepAlive);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public QuerySearchRequest(StreamInput in) throws IOException {
contextId = new ShardSearchContextId(in);
dfs = new AggregatedDfs(in);
originalIndices = OriginalIndices.readOriginalIndices(in);
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
this.shardSearchRequest = in.readOptionalWriteable(ShardSearchRequest::new);
} else {
this.shardSearchRequest = null;
Expand All @@ -71,7 +71,7 @@ public void writeTo(StreamOutput out) throws IOException {
contextId.writeTo(out);
dfs.writeTo(out);
OriginalIndices.writeOriginalIndices(originalIndices, out);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
out.writeOptionalWriteable(shardSearchRequest);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public void readFromWithId(ShardSearchContextId id, StreamInput in) throws IOExc
hasProfileResults = profileShardResults != null;
serviceTimeEWMA = in.readZLong();
nodeQueueSize = in.readInt();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
setShardSearchRequest(in.readOptionalWriteable(ShardSearchRequest::new));
setRescoreDocIds(new RescoreDocIds(in));
}
Expand Down Expand Up @@ -383,7 +383,7 @@ public void writeToNoId(StreamOutput out) throws IOException {
out.writeOptionalWriteable(profileShardResults);
out.writeZLong(serviceTimeEWMA);
out.writeInt(nodeQueueSize);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
out.writeOptionalWriteable(getShardSearchRequest());
getRescoreDocIds().writeTo(out);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
"Async search with point in time":
- skip:
version: " - 7.99.99"
reason: "point in time is introduced in 8.0"
version: " - 7.9.99"
reason: "point in time is introduced in 7.10"
- do:
indices.create:
index: test-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ setup:
---
"basic":
- skip:
version: " - 7.99.99"
reason: "point in time is introduced in 8.0"
version: " - 7.9.99"
reason: "point in time is introduced in 7.10"
- do:
open_point_in_time:
index: test
Expand Down Expand Up @@ -137,8 +137,8 @@ setup:
---
"wildcard":
- skip:
version: " - 7.99.99"
reason: "point in time is introduced in 8.0"
version: " - 7.9.99"
reason: "point in time is introduced in 7.10"
- do:
open_point_in_time:
index: "t*"
Expand Down

0 comments on commit 7b1ab6f

Please sign in to comment.