diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSizeStats.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSizeStats.java index 68a792c835c8a..fbdadd8f50f27 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSizeStats.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSizeStats.java @@ -226,6 +226,15 @@ public ModelSizeStats(StreamInput in) throws IOException { totalPartitionFieldCount = in.readVLong(); bucketAllocationFailuresCount = in.readVLong(); memoryStatus = MemoryStatus.readFromStream(in); + if (in.getVersion().onOrAfter(Version.V_7_11_0)) { + if (in.readBoolean()) { + assignmentMemoryBasis = AssignmentMemoryBasis.readFromStream(in); + } else { + assignmentMemoryBasis = null; + } + } else { + assignmentMemoryBasis = null; + } if (in.getVersion().onOrAfter(Version.V_7_7_0)) { categorizedDocCount = in.readVLong(); totalCategoryCount = in.readVLong(); @@ -247,15 +256,6 @@ public ModelSizeStats(StreamInput in) throws IOException { failedCategoryCount = 0; categorizationStatus = CategorizationStatus.OK; } - if (in.getVersion().onOrAfter(Version.V_7_11_0)) { - if (in.readBoolean()) { - assignmentMemoryBasis = AssignmentMemoryBasis.readFromStream(in); - } else { - assignmentMemoryBasis = null; - } - } else { - assignmentMemoryBasis = null; - } logTime = new Date(in.readVLong()); timestamp = in.readBoolean() ? new Date(in.readVLong()) : null; } @@ -286,6 +286,14 @@ public void writeTo(StreamOutput out) throws IOException { out.writeVLong(totalPartitionFieldCount); out.writeVLong(bucketAllocationFailuresCount); memoryStatus.writeTo(out); + if (out.getVersion().onOrAfter(Version.V_7_11_0)) { + if (assignmentMemoryBasis != null) { + out.writeBoolean(true); + assignmentMemoryBasis.writeTo(out); + } else { + out.writeBoolean(false); + } + } if (out.getVersion().onOrAfter(Version.V_7_7_0)) { out.writeVLong(categorizedDocCount); out.writeVLong(totalCategoryCount); @@ -297,14 +305,6 @@ public void writeTo(StreamOutput out) throws IOException { } categorizationStatus.writeTo(out); } - if (out.getVersion().onOrAfter(Version.V_7_11_0)) { - if (assignmentMemoryBasis != null) { - out.writeBoolean(true); - assignmentMemoryBasis.writeTo(out); - } else { - out.writeBoolean(false); - } - } out.writeVLong(logTime.getTime()); boolean hasTimestamp = timestamp != null; out.writeBoolean(hasTimestamp);