Skip to content

Commit 7b1ab6f

Browse files
authored
Adjust BWC after backporting point in time to 7.10 (#62262)
Relates #61062
1 parent abde6fb commit 7b1ab6f

File tree

11 files changed

+24
-33
lines changed

11 files changed

+24
-33
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ tasks.register("verifyVersions") {
174174
* after the backport of the backcompat code is complete.
175175
*/
176176

177-
boolean bwc_tests_enabled = false
178-
final String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/61872"
177+
boolean bwc_tests_enabled = true
178+
final String bwc_tests_disabled_issue = "" /* place a PR link here when committing bwc changes */
179179
if (bwc_tests_enabled == false) {
180180
if (bwc_tests_disabled_issue.isEmpty()) {
181181
throw new GradleException("bwc_tests_disabled_issue must be set when bwc_tests_enabled == false")

server/src/main/java/org/elasticsearch/action/search/SearchResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public SearchResponse(StreamInput in) throws IOException {
9696
scrollId = in.readOptionalString();
9797
tookInMillis = in.readVLong();
9898
skippedShards = in.readVInt();
99-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
99+
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
100100
pointInTimeId = in.readOptionalString();
101101
} else {
102102
pointInTimeId = null;
@@ -408,7 +408,7 @@ public void writeTo(StreamOutput out) throws IOException {
408408
out.writeOptionalString(scrollId);
409409
out.writeVLong(tookInMillis);
410410
out.writeVInt(skippedShards);
411-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
411+
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
412412
out.writeOptionalString(pointInTimeId);
413413
}
414414
}

server/src/main/java/org/elasticsearch/action/search/SearchTransportService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ public void writeTo(StreamOutput out) throws IOException {
281281
}
282282

283283
static boolean keepStatesInContext(Version version) {
284-
return version.before(Version.V_8_0_0);
284+
return version.before(Version.V_7_10_0);
285285
}
286286

287287
public static void registerRequestHandler(TransportService transportService, SearchService searchService) {

server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,6 @@ public SearchSourceBuilder(StreamInput in) throws IOException {
250250
if (in.readBoolean()) {
251251
fetchFields = in.readList(FieldAndFormat::new);
252252
}
253-
}
254-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
255253
pointInTimeBuilder = in.readOptionalWriteable(PointInTimeBuilder::new);
256254
}
257255
}
@@ -313,8 +311,6 @@ public void writeTo(StreamOutput out) throws IOException {
313311
if (fetchFields != null) {
314312
out.writeList(fetchFields);
315313
}
316-
}
317-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
318314
out.writeOptionalWriteable(pointInTimeBuilder);
319315
}
320316
}

server/src/main/java/org/elasticsearch/search/dfs/DfsSearchResult.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public DfsSearchResult(StreamInput in) throws IOException {
6161
fieldStatistics = readFieldStats(in);
6262

6363
maxDoc = in.readVInt();
64-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
64+
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
6565
setShardSearchRequest(in.readOptionalWriteable(ShardSearchRequest::new));
6666
}
6767
}
@@ -115,7 +115,7 @@ public void writeTo(StreamOutput out) throws IOException {
115115
writeTermStats(out, termStatistics);
116116
writeFieldStats(out, fieldStatistics);
117117
out.writeVInt(maxDoc);
118-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
118+
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
119119
out.writeOptionalWriteable(getShardSearchRequest());
120120
}
121121
}

server/src/main/java/org/elasticsearch/search/fetch/ShardFetchSearchRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public ShardFetchSearchRequest(OriginalIndices originalIndices, ShardSearchConte
5757
public ShardFetchSearchRequest(StreamInput in) throws IOException {
5858
super(in);
5959
originalIndices = OriginalIndices.readOriginalIndices(in);
60-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
60+
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
6161
shardSearchRequest = in.readOptionalWriteable(ShardSearchRequest::new);
6262
rescoreDocIds = new RescoreDocIds(in);
6363
aggregatedDfs = in.readOptionalWriteable(AggregatedDfs::new);
@@ -72,7 +72,7 @@ public ShardFetchSearchRequest(StreamInput in) throws IOException {
7272
public void writeTo(StreamOutput out) throws IOException {
7373
super.writeTo(out);
7474
OriginalIndices.writeOriginalIndices(originalIndices, out);
75-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
75+
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
7676
out.writeOptionalWriteable(shardSearchRequest);
7777
rescoreDocIds.writeTo(out);
7878
out.writeOptionalWriteable(aggregatedDfs);

server/src/main/java/org/elasticsearch/search/internal/ShardSearchRequest.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,13 @@ public ShardSearchRequest(StreamInput in) throws IOException {
204204
if (in.getVersion().onOrAfter(Version.V_7_7_0)) {
205205
canReturnNullResponseIfMatchNoDocs = in.readBoolean();
206206
bottomSortValues = in.readOptionalWriteable(SearchSortValuesAndFormats::new);
207+
readerId = in.readOptionalWriteable(ShardSearchContextId::new);
208+
keepAlive = in.readOptionalTimeValue();
207209
} else {
208210
canReturnNullResponseIfMatchNoDocs = false;
209211
bottomSortValues = null;
210-
}
211-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
212-
this.readerId = in.readOptionalWriteable(ShardSearchContextId::new);
213-
this.keepAlive = in.readOptionalTimeValue();
214-
} else {
215-
this.readerId = null;
216-
this.keepAlive = null;
212+
readerId = null;
213+
keepAlive = null;
217214
}
218215
originalIndices = OriginalIndices.readOriginalIndices(in);
219216
assert (readerId != null) == (keepAlive != null);
@@ -271,11 +268,9 @@ protected final void innerWriteTo(StreamOutput out, boolean asKey) throws IOExce
271268
out.writeStringArray(indexRoutings);
272269
out.writeOptionalString(preference);
273270
}
274-
if (out.getVersion().onOrAfter(Version.V_7_7_0) && asKey == false) {
271+
if (asKey == false && out.getVersion().onOrAfter(Version.V_7_7_0)) {
275272
out.writeBoolean(canReturnNullResponseIfMatchNoDocs);
276273
out.writeOptionalWriteable(bottomSortValues);
277-
}
278-
if (out.getVersion().onOrAfter(Version.V_8_0_0) && asKey == false) {
279274
out.writeOptionalWriteable(readerId);
280275
out.writeOptionalTimeValue(keepAlive);
281276
}

server/src/main/java/org/elasticsearch/search/query/QuerySearchRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public QuerySearchRequest(StreamInput in) throws IOException {
5858
contextId = new ShardSearchContextId(in);
5959
dfs = new AggregatedDfs(in);
6060
originalIndices = OriginalIndices.readOriginalIndices(in);
61-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
61+
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
6262
this.shardSearchRequest = in.readOptionalWriteable(ShardSearchRequest::new);
6363
} else {
6464
this.shardSearchRequest = null;
@@ -71,7 +71,7 @@ public void writeTo(StreamOutput out) throws IOException {
7171
contextId.writeTo(out);
7272
dfs.writeTo(out);
7373
OriginalIndices.writeOriginalIndices(originalIndices, out);
74-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
74+
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
7575
out.writeOptionalWriteable(shardSearchRequest);
7676
}
7777
}

server/src/main/java/org/elasticsearch/search/query/QuerySearchResult.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public void readFromWithId(ShardSearchContextId id, StreamInput in) throws IOExc
342342
hasProfileResults = profileShardResults != null;
343343
serviceTimeEWMA = in.readZLong();
344344
nodeQueueSize = in.readInt();
345-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
345+
if (in.getVersion().onOrAfter(Version.V_7_10_0)) {
346346
setShardSearchRequest(in.readOptionalWriteable(ShardSearchRequest::new));
347347
setRescoreDocIds(new RescoreDocIds(in));
348348
}
@@ -383,7 +383,7 @@ public void writeToNoId(StreamOutput out) throws IOException {
383383
out.writeOptionalWriteable(profileShardResults);
384384
out.writeZLong(serviceTimeEWMA);
385385
out.writeInt(nodeQueueSize);
386-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
386+
if (out.getVersion().onOrAfter(Version.V_7_10_0)) {
387387
out.writeOptionalWriteable(getShardSearchRequest());
388388
getRescoreDocIds().writeTo(out);
389389
}

x-pack/plugin/src/test/resources/rest-api-spec/test/async_search/20-with-poin-in-time.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
"Async search with point in time":
33
- skip:
4-
version: " - 7.99.99"
5-
reason: "point in time is introduced in 8.0"
4+
version: " - 7.9.99"
5+
reason: "point in time is introduced in 7.10"
66
- do:
77
indices.create:
88
index: test-1

0 commit comments

Comments
 (0)