Skip to content

Commit fd1e6d4

Browse files
authored
[ML] Replace Version.CURRENT in streaming functions (#36118)
1 parent f048c52 commit fd1e6d4

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/OpenJobAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public JobParams(String jobId) {
174174
public JobParams(StreamInput in) throws IOException {
175175
jobId = in.readString();
176176
timeout = TimeValue.timeValueMillis(in.readVLong());
177-
if (in.getVersion().onOrAfter(Version.CURRENT)) {
177+
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
178178
job = in.readOptionalWriteable(Job::new);
179179
}
180180
}
@@ -213,7 +213,7 @@ public String getWriteableName() {
213213
public void writeTo(StreamOutput out) throws IOException {
214214
out.writeString(jobId);
215215
out.writeVLong(timeout.millis());
216-
if (out.getVersion().onOrAfter(Version.CURRENT)) {
216+
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
217217
out.writeOptionalWriteable(job);
218218
}
219219
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartDatafeedAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public DatafeedParams(StreamInput in) throws IOException {
195195
startTime = in.readVLong();
196196
endTime = in.readOptionalLong();
197197
timeout = TimeValue.timeValueMillis(in.readVLong());
198-
if (in.getVersion().onOrAfter(Version.CURRENT)) {
198+
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
199199
jobId = in.readOptionalString();
200200
datafeedIndices = in.readList(StreamInput::readString);
201201
}
@@ -272,7 +272,7 @@ public void writeTo(StreamOutput out) throws IOException {
272272
out.writeVLong(startTime);
273273
out.writeOptionalLong(endTime);
274274
out.writeVLong(timeout.millis());
275-
if (out.getVersion().onOrAfter(Version.CURRENT)) {
275+
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
276276
out.writeOptionalString(jobId);
277277
out.writeStringList(datafeedIndices);
278278
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/UpdateJobAction.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,7 @@ public void readFrom(StreamInput in) throws IOException {
9797
} else {
9898
isInternal = false;
9999
}
100-
// TODO jindex change CURRENT to specific version when feature branch is merged
101-
if (in.getVersion().onOrAfter(Version.V_6_3_0) && in.getVersion().before(Version.CURRENT)) {
100+
if (in.getVersion().onOrAfter(Version.V_6_3_0) && in.getVersion().before(Version.V_7_0_0)) {
102101
in.readBoolean(); // was waitForAck
103102
}
104103
}
@@ -111,8 +110,7 @@ public void writeTo(StreamOutput out) throws IOException {
111110
if (out.getVersion().onOrAfter(Version.V_6_2_2)) {
112111
out.writeBoolean(isInternal);
113112
}
114-
// TODO jindex change CURRENT to specific version when feature branch is merged
115-
if (out.getVersion().onOrAfter(Version.V_6_3_0) && out.getVersion().before(Version.CURRENT)) {
113+
if (out.getVersion().onOrAfter(Version.V_6_3_0) && out.getVersion().before(Version.V_7_0_0)) {
116114
out.writeBoolean(false); // was waitForAck
117115
}
118116
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/Job.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ public Builder setModelSnapshotMinVersion(Version modelSnapshotMinVersion) {
809809
return this;
810810
}
811811

812-
public Builder setModelSnapshotMinVersion(String modelSnapshotMinVersion) {
812+
Builder setModelSnapshotMinVersion(String modelSnapshotMinVersion) {
813813
this.modelSnapshotMinVersion = Version.fromString(modelSnapshotMinVersion);
814814
return this;
815815
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,16 @@ public JobUpdate(StreamInput in) throws IOException {
140140
} else {
141141
jobVersion = null;
142142
}
143+
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
144+
clearJobFinishTime = in.readOptionalBoolean();
145+
} else {
146+
clearJobFinishTime = null;
147+
}
143148
if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) {
144149
modelSnapshotMinVersion = Version.readVersion(in);
145150
} else {
146151
modelSnapshotMinVersion = null;
147152
}
148-
if (in.getVersion().onOrAfter(Version.CURRENT)) { // NORELEASE change current to Jindex release version
149-
clearJobFinishTime = in.readOptionalBoolean();
150-
} else {
151-
clearJobFinishTime = null;
152-
}
153153
}
154154

155155
@Override
@@ -188,6 +188,9 @@ public void writeTo(StreamOutput out) throws IOException {
188188
out.writeBoolean(false);
189189
}
190190
}
191+
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
192+
out.writeOptionalBoolean(clearJobFinishTime);
193+
}
191194
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
192195
if (modelSnapshotMinVersion != null) {
193196
out.writeBoolean(true);
@@ -196,9 +199,6 @@ public void writeTo(StreamOutput out) throws IOException {
196199
out.writeBoolean(false);
197200
}
198201
}
199-
if (out.getVersion().onOrAfter(Version.CURRENT)) { // NORELEASE change current to Jindex release version
200-
out.writeOptionalBoolean(clearJobFinishTime);
201-
}
202202
}
203203

204204
public String getJobId() {

0 commit comments

Comments
 (0)