Skip to content

Commit ed83181

Browse files
Adding transport version check
1 parent 14b75e8 commit ed83181

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ static TransportVersion def(int id) {
196196
public static final TransportVersion ML_INFERENCE_ELASTIC_RERANK_ADDED_8_19 = def(8_841_0_48);
197197
public static final TransportVersion NONE_CHUNKING_STRATEGY_8_19 = def(8_841_0_49);
198198
public static final TransportVersion IDP_CUSTOM_SAML_ATTRIBUTES_ALLOW_LIST_8_19 = def(8_841_0_50);
199+
public static final TransportVersion ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING_8_19 = def(8_841_0_51);
199200
public static final TransportVersion V_9_0_0 = def(9_000_0_09);
200201
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_1 = def(9_000_0_10);
201202
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0_2 = def(9_000_0_11);
@@ -298,6 +299,7 @@ static TransportVersion def(int id) {
298299
public static final TransportVersion HEAP_USAGE_IN_CLUSTER_INFO = def(9_096_0_00);
299300
public static final TransportVersion NONE_CHUNKING_STRATEGY = def(9_097_0_00);
300301
public static final TransportVersion PROJECT_DELETION_GLOBAL_BLOCK = def(9_098_0_00);
302+
public static final TransportVersion ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING = def(9_099_0_00);
301303

302304
/*
303305
* STOP! READ THIS FIRST! No, really,

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/custom/CustomServiceSettings.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ public CustomServiceSettings(StreamInput in) throws IOException {
223223
requestContentString = in.readString();
224224
responseJsonParser = in.readNamedWriteable(CustomResponseParser.class);
225225
rateLimitSettings = new RateLimitSettings(in);
226+
if (in.getTransportVersion().before(TransportVersions.ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING)
227+
&& in.getTransportVersion().isPatchFrom(TransportVersions.ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING_8_19) == false) {
228+
// Read the error parsing fields for backwards compatibility
229+
in.readString();
230+
in.readString();
231+
}
226232
}
227233

228234
@Override
@@ -337,6 +343,12 @@ public void writeTo(StreamOutput out) throws IOException {
337343
out.writeString(requestContentString);
338344
out.writeNamedWriteable(responseJsonParser);
339345
rateLimitSettings.writeTo(out);
346+
if (out.getTransportVersion().before(TransportVersions.ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING)
347+
&& out.getTransportVersion().isPatchFrom(TransportVersions.ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING_8_19) == false) {
348+
// Write empty strings for backwards compatibility for the error parsing fields
349+
out.writeString("");
350+
out.writeString("");
351+
}
340352
}
341353

342354
@Override

0 commit comments

Comments
 (0)