8
8
9
9
package org .elasticsearch .tasks ;
10
10
11
- import org .elasticsearch .Version ;
12
11
import org .elasticsearch .common .ParseField ;
13
12
import org .elasticsearch .common .Strings ;
14
13
import org .elasticsearch .common .bytes .BytesReference ;
@@ -104,11 +103,7 @@ public TaskInfo(StreamInput in) throws IOException {
104
103
startTime = in .readLong ();
105
104
runningTimeNanos = in .readLong ();
106
105
cancellable = in .readBoolean ();
107
- if (in .getVersion ().onOrAfter (Version .V_8_0_0 )) {
108
- cancelled = in .readBoolean ();
109
- } else {
110
- cancelled = false ; // older versions do not report when tasks are cancelled so we just assume they aren't
111
- }
106
+ cancelled = in .readBoolean ();
112
107
assert cancellable || cancelled == false : "uncancellable task cannot be cancelled" ;
113
108
parentTaskId = TaskId .readFromStream (in );
114
109
headers = in .readMap (StreamInput ::readString , StreamInput ::readString );
@@ -124,9 +119,7 @@ public void writeTo(StreamOutput out) throws IOException {
124
119
out .writeLong (startTime );
125
120
out .writeLong (runningTimeNanos );
126
121
out .writeBoolean (cancellable );
127
- if (out .getVersion ().onOrAfter (Version .V_8_0_0 )) {
128
- out .writeBoolean (cancelled );
129
- } // older versions do not report when tasks are cancelled anyway so it's ok just to drop this flag
122
+ out .writeBoolean (cancelled );
130
123
parentTaskId .writeTo (out );
131
124
out .writeMap (headers , StreamOutput ::writeString , StreamOutput ::writeString );
132
125
}
0 commit comments