7.x/ml fix instance serialization bwc (#46404)

* [ML] Fixing instance serialization version for bwc

* fixing CppLogMessage
This commit is contained in:
Benjamin Trent 2019-09-05 13:23:26 -05:00 committed by GitHub
parent d912a49c6f
commit 457ff3e2fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -85,7 +85,7 @@ public class ScheduledEvent implements ToXContentObject, Writeable {
public ScheduledEvent(StreamInput in) throws IOException {
description = in.readString();
if (in.getVersion().onOrAfter(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_7_4_0)) {
startTime = in.readInstant();
endTime = in.readInstant();
} else {
@ -146,7 +146,7 @@ public class ScheduledEvent implements ToXContentObject, Writeable {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(description);
if (out.getVersion().onOrAfter(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_7_4_0)) {
out.writeInstant(startTime);
out.writeInstant(endTime);
} else {

View File

@ -130,7 +130,7 @@ public class ForecastRequestStats implements ToXContentObject, Writeable {
messages = null;
}
if (in.getVersion().onOrAfter(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_7_4_0)) {
timestamp = in.readInstant();
startTime = in.readInstant();
endTime = in.readInstant();
@ -161,7 +161,7 @@ public class ForecastRequestStats implements ToXContentObject, Writeable {
} else {
out.writeBoolean(false);
}
if (out.getVersion().onOrAfter(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_7_4_0)) {
out.writeInstant(timestamp);
out.writeInstant(startTime);
out.writeInstant(endTime);

View File

@ -75,7 +75,7 @@ public class CppLogMessage implements ToXContentObject, Writeable {
public CppLogMessage(StreamInput in) throws IOException {
logger = in.readString();
if (in.getVersion().onOrAfter(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_7_4_0)) {
timestamp = in.readInstant();
} else {
timestamp = Instant.ofEpochMilli(in.readVLong());
@ -93,7 +93,7 @@ public class CppLogMessage implements ToXContentObject, Writeable {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(logger);
if (out.getVersion().onOrAfter(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_7_4_0)) {
out.writeInstant(timestamp);
} else {
out.writeVLong(timestamp.toEpochMilli());