Skip to content

Commit

Permalink
[ML] adjusting bwc serialization for elastic#77256
Browse files Browse the repository at this point in the history
  • Loading branch information
benwtrent committed Sep 3, 2021
1 parent 574d643 commit e5b26d3
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
package org.elasticsearch.xpack.core.ml.action;

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ActionType;
Expand Down Expand Up @@ -65,11 +64,7 @@ public Request(TrainedModelConfig config, boolean deferDefinitionDecompression)
public Request(StreamInput in) throws IOException {
super(in);
this.config = new TrainedModelConfig(in);
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
this.deferDefinitionDecompression = in.readBoolean();
} else {
this.deferDefinitionDecompression = false;
}
this.deferDefinitionDecompression = in.readBoolean();
}

public TrainedModelConfig getTrainedModelConfig() {
Expand Down Expand Up @@ -100,9 +95,7 @@ public boolean isDeferDefinitionDecompression() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
config.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeBoolean(deferDefinitionDecompression);
}
out.writeBoolean(deferDefinitionDecompression);
}

@Override
Expand Down

0 comments on commit e5b26d3

Please sign in to comment.