Skip to content

Commit cace905

Browse files
authored
Prepare backport of transport version STORED_SCRIPT_CONTENT_LENGTH to 9.0 (#125127)
Prepare backport of transport version STORED_SCRIPT_CONTENT_LENGTH to 9.0 Relates to #123860
1 parent 64a5643 commit cace905

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

server/src/main/java/org/elasticsearch/TransportVersions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ static TransportVersion def(int id) {
157157
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90 = def(9_000_0_06);
158158
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_90 = def(9_000_0_07);
159159
public static final TransportVersion RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90 = def(9_000_0_08);
160+
public static final TransportVersion STORED_SCRIPT_CONTENT_LENGTH_90 = def(9_000_0_09);
160161
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_001_0_00);
161162
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES = def(9_002_0_00);
162163
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED = def(9_003_0_00);

server/src/main/java/org/elasticsearch/action/admin/cluster/storedscripts/PutStoredScriptRequest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptR
4545
public PutStoredScriptRequest(StreamInput in) throws IOException {
4646
super(in);
4747
id = in.readOptionalString();
48-
if (in.getTransportVersion().onOrAfter(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH)) {
48+
if (in.getTransportVersion().isPatchFrom(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH_90)
49+
|| in.getTransportVersion().onOrAfter(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH)) {
4950
contentLength = in.readVInt();
5051
} else {
5152
BytesReference content = in.readBytesReference();
@@ -105,7 +106,8 @@ public StoredScriptSource source() {
105106
public void writeTo(StreamOutput out) throws IOException {
106107
super.writeTo(out);
107108
out.writeOptionalString(id);
108-
if (out.getTransportVersion().onOrAfter(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH)) {
109+
if (out.getTransportVersion().isPatchFrom(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH_90)
110+
|| out.getTransportVersion().onOrAfter(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH)) {
109111
out.writeVInt(contentLength);
110112
} else {
111113
// generate a bytes reference of the correct size (the content isn't actually used in 8.18)

0 commit comments

Comments
 (0)