Skip to content

Commit

Permalink
Adjust wire version for search context id
Browse files Browse the repository at this point in the history
Relates #53143
  • Loading branch information
dnhatn committed Mar 11, 2020
1 parent 7ba94d8 commit cd6d0b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void innerRun() throws IOException {
final List<SearchPhaseResult> phaseResults = queryResults.asList();
final String scrollId;
if (isScrollSearch) {
final boolean includeContextUUID = clusterState.nodes().getMinNodeVersion().onOrAfter(Version.V_8_0_0);
final boolean includeContextUUID = clusterState.nodes().getMinNodeVersion().onOrAfter(Version.V_7_7_0);
scrollId = TransportSearchHelper.buildScrollId(queryResults, includeContextUUID);
} else {
scrollId = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public SearchContextId(String readerId, long id) {

public SearchContextId(StreamInput in) throws IOException {
this.id = in.readLong();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
if (in.getVersion().onOrAfter(Version.V_7_7_0)) {
this.readerId = in.readString();
} else {
this.readerId = "";
Expand All @@ -49,7 +49,7 @@ public SearchContextId(StreamInput in) throws IOException {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeLong(id);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
if (out.getVersion().onOrAfter(Version.V_7_7_0)) {
out.writeString(readerId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ public void testSearchContextMissingException() throws IOException {
Version version = VersionUtils.randomVersion(random());
SearchContextMissingException ex = serialize(new SearchContextMissingException(contextId), version);
assertThat(ex.contextId().getId(), equalTo(contextId.getId()));
if (version.onOrAfter(Version.V_8_0_0)) {
if (version.onOrAfter(Version.V_7_7_0)) {
assertThat(ex.contextId().getReaderId(), equalTo(contextId.getReaderId()));
} else {
assertThat(ex.contextId().getReaderId(), equalTo(""));
Expand Down

0 comments on commit cd6d0b7

Please sign in to comment.