Add missing serialization BWC for disk usage estimates

Relates to #22081
This commit is contained in:
Lee Hinman 2017-01-19 14:55:49 -07:00
parent 296f4aac7a
commit eb8a41ef94
1 changed files with 12 additions and 4 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.monitor.fs; package org.elasticsearch.monitor.fs;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.DiskUsage; import org.elasticsearch.cluster.DiskUsage;
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
@ -466,8 +467,13 @@ public class FsInfo implements Iterable<FsInfo.Path>, Writeable, ToXContent {
paths[i] = new Path(in); paths[i] = new Path(in);
} }
this.total = total(); this.total = total();
this.leastDiskEstimate = in.readOptionalWriteable(DiskUsage::new); if (in.getVersion().onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) {
this.mostDiskEstimate = in.readOptionalWriteable(DiskUsage::new); this.leastDiskEstimate = in.readOptionalWriteable(DiskUsage::new);
this.mostDiskEstimate = in.readOptionalWriteable(DiskUsage::new);
} else {
this.leastDiskEstimate = null;
this.mostDiskEstimate = null;
}
} }
@Override @Override
@ -478,8 +484,10 @@ public class FsInfo implements Iterable<FsInfo.Path>, Writeable, ToXContent {
for (Path path : paths) { for (Path path : paths) {
path.writeTo(out); path.writeTo(out);
} }
out.writeOptionalWriteable(this.leastDiskEstimate); if (out.getVersion().onOrAfter(Version.V_6_0_0_alpha1_UNRELEASED)) {
out.writeOptionalWriteable(this.mostDiskEstimate); out.writeOptionalWriteable(this.leastDiskEstimate);
out.writeOptionalWriteable(this.mostDiskEstimate);
}
} }
public Path getTotal() { public Path getTotal() {