Skip to content

Commit e54c320

Browse files
committed
Added bwc checks
Signed-off-by: Owais Kazi <[email protected]>
1 parent f96592e commit e54c320

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

common/src/main/java/org/opensearch/ml/common/transport/agent/MLAgentUpdateInput.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import static org.opensearch.ml.common.CommonValue.TENANT_ID_FIELD;
1010
import static org.opensearch.ml.common.CommonValue.VERSION_2_19_0;
1111
import static org.opensearch.ml.common.utils.StringUtils.getParameterMap;
12+
import static org.opensearch.ml.common.CommonValue.VERSION_3_3_0;
1213

1314
import java.io.IOException;
1415
import java.time.Instant;
@@ -109,7 +110,7 @@ public MLAgentUpdateInput(StreamInput in) throws IOException {
109110
Version streamInputVersion = in.getVersion();
110111
agentId = in.readString();
111112
name = in.readOptionalString();
112-
type = in.readOptionalString();
113+
type = streamInputVersion.onOrAfter(VERSION_3_3_0) ? in.readOptionalString() : null;
113114
description = in.readOptionalString();
114115
llmModelId = in.readOptionalString();
115116
if (in.readBoolean()) {
@@ -193,7 +194,9 @@ public void writeTo(StreamOutput out) throws IOException {
193194
Version streamOutputVersion = out.getVersion();
194195
out.writeString(agentId);
195196
out.writeOptionalString(name);
196-
out.writeOptionalString(type);
197+
if (streamOutputVersion.onOrAfter(VERSION_3_3_0)) {
198+
out.writeOptionalString(type);
199+
}
197200
out.writeOptionalString(description);
198201
out.writeOptionalString(llmModelId);
199202
if (llmParameters != null && !llmParameters.isEmpty()) {

0 commit comments

Comments
 (0)