Skip to content

Commit

Permalink
Account for transportversion with missing minCompatibleShardNode
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoop committed Oct 17, 2024
1 parent a775231 commit 5002a6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ static TransportVersion def(int id) {
public static final TransportVersion ESQL_PER_AGGREGATE_FILTER = def(8_770_00_0);
public static final TransportVersion ML_INFERENCE_ATTACH_TO_EXISTSING_DEPLOYMENT = def(8_771_00_0);
public static final TransportVersion CONVERT_FAILURE_STORE_OPTIONS_TO_SELECTOR_OPTIONS_INTERNALLY = def(8_772_00_0);
public static final TransportVersion REMOVE_MIN_COMPATIBLE_SHARD_NODE = def(8_773_00_0);
public static final TransportVersion REVERT_REMOVE_MIN_COMPATIBLE_SHARD_NODE = def(8_774_00_0);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ public SearchRequest(StreamInput in) throws IOException {
finalReduce = true;
}
ccsMinimizeRoundtrips = in.readBoolean();
if (in.readBoolean()) {
if ((in.getTransportVersion().before(TransportVersions.REMOVE_MIN_COMPATIBLE_SHARD_NODE)
|| in.getTransportVersion().onOrAfter(TransportVersions.REVERT_REMOVE_MIN_COMPATIBLE_SHARD_NODE)) && in.readBoolean()) {
minCompatibleShardNode = Version.readVersion(in);
} else {
minCompatibleShardNode = null;
Expand Down Expand Up @@ -303,7 +304,9 @@ public void writeTo(StreamOutput out) throws IOException {
}
out.writeBoolean(ccsMinimizeRoundtrips);
out.writeBoolean(minCompatibleShardNode != null);
if (minCompatibleShardNode != null) {
if ((out.getTransportVersion().before(TransportVersions.REMOVE_MIN_COMPATIBLE_SHARD_NODE)
|| out.getTransportVersion().onOrAfter(TransportVersions.REVERT_REMOVE_MIN_COMPATIBLE_SHARD_NODE))
&& minCompatibleShardNode != null) {
Version.writeVersion(minCompatibleShardNode, out);
}
out.writeMap(waitForCheckpoints, StreamOutput::writeLongArray);
Expand Down

0 comments on commit 5002a6d

Please sign in to comment.