Skip to content

Commit

Permalink
Internal: Fix serialization of PendingClusterTask.timeInQueue.
Browse files Browse the repository at this point in the history
This parameter is serialized as a vLong while it could sometimes be negative.

Close #8077
  • Loading branch information
jpountz committed Oct 14, 2014
1 parent 53378e4 commit 1e04e07
Showing 1 changed file with 11 additions and 2 deletions.
Expand Up @@ -79,7 +79,11 @@ public void readFrom(StreamInput in) throws IOException {
insertOrder = in.readVLong();
priority = Priority.readFrom(in);
source = in.readText();
timeInQueue = in.readVLong();
if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
timeInQueue = in.readLong();
} else {
timeInQueue = in.readVLong();
}
if (in.getVersion().onOrAfter(Version.V_1_3_0)) {
executing = in.readBoolean();
}
Expand All @@ -90,7 +94,12 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(insertOrder);
Priority.writeTo(priority, out);
out.writeText(source);
out.writeVLong(timeInQueue);
if (out.getVersion().onOrAfter(Version.V_1_4_0)) {
// timeInQueue is set to -1 when unknown and can be negative if time goes backwards
out.writeLong(timeInQueue);
} else {
out.writeVLong(timeInQueue);
}
if (out.getVersion().onOrAfter(Version.V_1_3_0)) {
out.writeBoolean(executing);
}
Expand Down

0 comments on commit 1e04e07

Please sign in to comment.