Skip to content

Commit 4a5a16a

Browse files
authored
[ML] Fix serialization order for model_size_stats (#66015)
Due to a backporting mistake, master and 7.x were serializing the members of model_size_stats in different orders. This led to BWC test failures on master. This change makes the ordering in 7.x the same as the ordering in master. It will be tested when the mute done in #65895 is reverted on the master branch. Fixes #65893
1 parent a4703d7 commit 4a5a16a

File tree

1 file changed

+17
-17
lines changed
  • x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state

1 file changed

+17
-17
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSizeStats.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,15 @@ public ModelSizeStats(StreamInput in) throws IOException {
226226
totalPartitionFieldCount = in.readVLong();
227227
bucketAllocationFailuresCount = in.readVLong();
228228
memoryStatus = MemoryStatus.readFromStream(in);
229+
if (in.getVersion().onOrAfter(Version.V_7_11_0)) {
230+
if (in.readBoolean()) {
231+
assignmentMemoryBasis = AssignmentMemoryBasis.readFromStream(in);
232+
} else {
233+
assignmentMemoryBasis = null;
234+
}
235+
} else {
236+
assignmentMemoryBasis = null;
237+
}
229238
if (in.getVersion().onOrAfter(Version.V_7_7_0)) {
230239
categorizedDocCount = in.readVLong();
231240
totalCategoryCount = in.readVLong();
@@ -247,15 +256,6 @@ public ModelSizeStats(StreamInput in) throws IOException {
247256
failedCategoryCount = 0;
248257
categorizationStatus = CategorizationStatus.OK;
249258
}
250-
if (in.getVersion().onOrAfter(Version.V_7_11_0)) {
251-
if (in.readBoolean()) {
252-
assignmentMemoryBasis = AssignmentMemoryBasis.readFromStream(in);
253-
} else {
254-
assignmentMemoryBasis = null;
255-
}
256-
} else {
257-
assignmentMemoryBasis = null;
258-
}
259259
logTime = new Date(in.readVLong());
260260
timestamp = in.readBoolean() ? new Date(in.readVLong()) : null;
261261
}
@@ -286,6 +286,14 @@ public void writeTo(StreamOutput out) throws IOException {
286286
out.writeVLong(totalPartitionFieldCount);
287287
out.writeVLong(bucketAllocationFailuresCount);
288288
memoryStatus.writeTo(out);
289+
if (out.getVersion().onOrAfter(Version.V_7_11_0)) {
290+
if (assignmentMemoryBasis != null) {
291+
out.writeBoolean(true);
292+
assignmentMemoryBasis.writeTo(out);
293+
} else {
294+
out.writeBoolean(false);
295+
}
296+
}
289297
if (out.getVersion().onOrAfter(Version.V_7_7_0)) {
290298
out.writeVLong(categorizedDocCount);
291299
out.writeVLong(totalCategoryCount);
@@ -297,14 +305,6 @@ public void writeTo(StreamOutput out) throws IOException {
297305
}
298306
categorizationStatus.writeTo(out);
299307
}
300-
if (out.getVersion().onOrAfter(Version.V_7_11_0)) {
301-
if (assignmentMemoryBasis != null) {
302-
out.writeBoolean(true);
303-
assignmentMemoryBasis.writeTo(out);
304-
} else {
305-
out.writeBoolean(false);
306-
}
307-
}
308308
out.writeVLong(logTime.getTime());
309309
boolean hasTimestamp = timestamp != null;
310310
out.writeBoolean(hasTimestamp);

0 commit comments

Comments
 (0)