Skip to content

Commit 1c9e0bb

Browse files
author
David Roberts
authored
[ML] Adjust BWC version following backport (#47994)
The BWC version for await_lazy_open/await_lazy_start should be 7.5.0 now #47726 is backported.
1 parent d7ae6de commit 1c9e0bb

File tree

11 files changed

+80
-34
lines changed

11 files changed

+80
-34
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ public TaskParams(StreamInput in) throws IOException {
197197
} else {
198198
progressOnStart = Collections.emptyList();
199199
}
200-
// TODO: change version in backport
201-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
200+
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
202201
allowLazyStart = in.readBoolean();
203202
} else {
204203
allowLazyStart = false;
@@ -234,8 +233,7 @@ public void writeTo(StreamOutput out) throws IOException {
234233
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
235234
out.writeList(progressOnStart);
236235
}
237-
// TODO: change version in backport
238-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
236+
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
239237
out.writeBoolean(allowLazyStart);
240238
}
241239
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsConfig.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,7 @@ public DataFrameAnalyticsConfig(StreamInput in) throws IOException {
163163
createTime = null;
164164
version = null;
165165
}
166-
// TODO: change version in backport
167-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
166+
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
168167
allowLazyStart = in.readBoolean();
169168
} else {
170169
allowLazyStart = false;
@@ -271,8 +270,7 @@ public void writeTo(StreamOutput out) throws IOException {
271270
out.writeBoolean(false);
272271
}
273272
}
274-
// TODO: change version in backport
275-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
273+
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
276274
out.writeBoolean(allowLazyStart);
277275
}
278276
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsState.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ public static DataFrameAnalyticsState fromStream(StreamInput in) throws IOExcept
2929
@Override
3030
public void writeTo(StreamOutput out) throws IOException {
3131
DataFrameAnalyticsState toWrite = this;
32-
// TODO: change version in backport
33-
if (out.getVersion().before(Version.V_8_0_0) && toWrite == STARTING) {
32+
if (out.getVersion().before(Version.V_7_5_0) && toWrite == STARTING) {
3433
// Before 7.5.0 there was no STARTING state and jobs for which
3534
// tasks existed but were unassigned were considered STOPPED
3635
toWrite = STOPPED;

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ public Job(StreamInput in) throws IOException {
225225
}
226226
resultsIndexName = in.readString();
227227
deleting = in.readBoolean();
228-
// TODO: change version in backport
229-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
228+
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
230229
allowLazyOpen = in.readBoolean();
231230
} else {
232231
allowLazyOpen = false;
@@ -495,8 +494,7 @@ public void writeTo(StreamOutput out) throws IOException {
495494
}
496495
out.writeString(resultsIndexName);
497496
out.writeBoolean(deleting);
498-
// TODO: change version in backport
499-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
497+
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
500498
out.writeBoolean(allowLazyOpen);
501499
}
502500
}
@@ -718,8 +716,7 @@ public Builder(StreamInput in) throws IOException {
718716
}
719717
resultsIndexName = in.readOptionalString();
720718
deleting = in.readBoolean();
721-
// TODO: change version in backport
722-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
719+
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
723720
allowLazyOpen = in.readBoolean();
724721
}
725722
}
@@ -915,8 +912,7 @@ public void writeTo(StreamOutput out) throws IOException {
915912
}
916913
out.writeOptionalString(resultsIndexName);
917914
out.writeBoolean(deleting);
918-
// TODO: change version in backport
919-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
915+
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
920916
out.writeBoolean(allowLazyOpen);
921917
}
922918
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ public JobUpdate(StreamInput in) throws IOException {
142142
} else {
143143
modelSnapshotMinVersion = null;
144144
}
145-
// TODO: change version in backport
146-
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
145+
if (in.getVersion().onOrAfter(Version.V_7_5_0)) {
147146
allowLazyOpen = in.readOptionalBoolean();
148147
} else {
149148
allowLazyOpen = null;
@@ -187,8 +186,7 @@ public void writeTo(StreamOutput out) throws IOException {
187186
out.writeBoolean(false);
188187
}
189188
}
190-
// TODO: change version in backport
191-
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
189+
if (out.getVersion().onOrAfter(Version.V_7_5_0)) {
192190
out.writeOptionalBoolean(allowLazyOpen);
193191
}
194192
}

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/dataframe/DataFrameAnalyticsStateTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ public void testWriteStartingStateToPre75() throws IOException {
4949

5050
public void testWriteStartingStateToPost75() throws IOException {
5151
StreamOutput streamOutput = mock(StreamOutput.class);
52-
// TODO: change version in backport
53-
when(streamOutput.getVersion()).thenReturn(Version.V_8_0_0);
52+
when(streamOutput.getVersion()).thenReturn(Version.V_7_5_0);
5453
DataFrameAnalyticsState.STARTING.writeTo(streamOutput);
5554
verify(streamOutput, times(1)).writeEnum(DataFrameAnalyticsState.STARTING);
5655
}

x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/integration/MlDistributedFailureIT.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
package org.elasticsearch.xpack.ml.integration;
77

8-
import org.elasticsearch.ElasticsearchStatusException;
98
import org.elasticsearch.action.search.SearchResponse;
109
import org.elasticsearch.cluster.ClusterState;
1110
import org.elasticsearch.cluster.metadata.MetaData;
@@ -168,16 +167,9 @@ public void testCloseUnassignedJobAndDatafeed() throws Exception {
168167
StopDatafeedAction.Response stopDatafeedResponse = client().execute(StopDatafeedAction.INSTANCE, stopDatafeedRequest).actionGet();
169168
assertTrue(stopDatafeedResponse.isStopped());
170169

171-
// Can't normal stop an unassigned job
170+
// Since 7.5 we can also stop an unassigned job either normally or by force
172171
CloseJobAction.Request closeJobRequest = new CloseJobAction.Request(jobId);
173-
ElasticsearchStatusException statusException = expectThrows(ElasticsearchStatusException.class,
174-
() -> client().execute(CloseJobAction.INSTANCE, closeJobRequest).actionGet());
175-
assertEquals("Cannot close job [" + jobId +
176-
"] because the job does not have an assigned node. Use force close to close the job",
177-
statusException.getMessage());
178-
179-
// Can only force close an unassigned job
180-
closeJobRequest.setForce(true);
172+
closeJobRequest.setForce(randomBoolean());
181173
CloseJobAction.Response closeJobResponse = client().execute(CloseJobAction.INSTANCE, closeJobRequest).actionGet();
182174
assertTrue(closeJobResponse.isClosed());
183175
}

x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/30_ml_jobs_crud.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
22
"Test get old cluster job":
3+
- skip:
4+
version: "7.5.0 - "
5+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
36
- do:
47
ml.get_jobs:
58
job_id: old-cluster-job
@@ -37,6 +40,9 @@
3740

3841
---
3942
"Test get old cluster job's timing stats":
43+
- skip:
44+
version: "7.5.0 - "
45+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
4046
- do:
4147
ml.get_job_stats:
4248
job_id: old-cluster-job-with-ts
@@ -51,6 +57,9 @@
5157

5258
---
5359
"Test get old cluster categorization job":
60+
- skip:
61+
version: "7.5.0 - "
62+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
5463
- do:
5564
ml.get_jobs:
5665
job_id: old-cluster-categorization-job
@@ -88,6 +97,9 @@
8897

8998
---
9099
"Create a job in the mixed cluster and write some data":
100+
- skip:
101+
version: "7.5.0 - "
102+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
91103
- do:
92104
ml.put_job:
93105
job_id: mixed-cluster-job
@@ -141,6 +153,9 @@
141153
---
142154
"Test job with pre 6.4 rules":
143155

156+
- skip:
157+
version: "7.5.0 - "
158+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
144159
- do:
145160
ml.get_jobs:
146161
job_id: job-with-old-rules

x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/90_ml_data_frame_analytics_crud.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
"Get old outlier_detection job":
33

4+
- skip:
5+
version: "7.5.0 - "
6+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
47
- do:
58
ml.get_data_frame_analytics:
69
id: "old_cluster_outlier_detection_job"
@@ -20,6 +23,9 @@
2023
---
2124
"Get old outlier_detection job stats":
2225

26+
- skip:
27+
version: "7.5.0 - "
28+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
2329
- do:
2430
ml.get_data_frame_analytics_stats:
2531
id: "old_cluster_outlier_detection_job"
@@ -30,6 +36,9 @@
3036
---
3137
"Start and stop old outlier_detection job":
3238

39+
- skip:
40+
version: "7.5.0 - "
41+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
3342
- do:
3443
ml.start_data_frame_analytics:
3544
id: "old_cluster_outlier_detection_job"
@@ -50,6 +59,9 @@
5059
---
5160
"Get old regression job":
5261

62+
- skip:
63+
version: "7.5.0 - "
64+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
5365
- do:
5466
ml.get_data_frame_analytics:
5567
id: "old_cluster_regression_job"
@@ -63,6 +75,9 @@
6375
---
6476
"Get old regression job stats":
6577

78+
- skip:
79+
version: "7.5.0 - "
80+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
6681
- do:
6782
ml.get_data_frame_analytics_stats:
6883
id: "old_cluster_regression_job"
@@ -73,6 +88,9 @@
7388
---
7489
"Start and stop old regression job":
7590

91+
- skip:
92+
version: "7.5.0 - "
93+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
7694
- do:
7795
ml.start_data_frame_analytics:
7896
id: "old_cluster_regression_job"
@@ -93,6 +111,9 @@
93111
---
94112
"Put an outlier_detection job on the mixed cluster":
95113

114+
- skip:
115+
version: "7.5.0 - "
116+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
96117
- do:
97118
ml.put_data_frame_analytics:
98119
id: "mixed_cluster_outlier_detection_job"

x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/30_ml_jobs_crud.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ setup:
88

99
---
1010
"Test open old jobs":
11+
- skip:
12+
version: "7.5.0 - "
13+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
1114
- do:
1215
ml.open_job:
1316
job_id: old-cluster-job
@@ -111,6 +114,9 @@ setup:
111114

112115
---
113116
"Test get old cluster job's timing stats":
117+
- skip:
118+
version: "7.5.0 - "
119+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
114120
- do:
115121
ml.get_job_stats:
116122
job_id: old-cluster-job-with-ts
@@ -136,6 +142,9 @@ setup:
136142
---
137143
"Test job with pre 6.4 rules":
138144

145+
- skip:
146+
version: "7.5.0 - "
147+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
139148
- do:
140149
ml.get_jobs:
141150
job_id: job-with-old-rules
@@ -146,6 +155,9 @@ setup:
146155
---
147156
"Test get job with function shortcut should expand":
148157

158+
- skip:
159+
version: "7.5.0 - "
160+
reason: waiting merge of https://github.com/elastic/elasticsearch/pull/47993
149161
- do:
150162
ml.get_jobs:
151163
job_id: old-cluster-function-shortcut-expansion

0 commit comments

Comments
 (0)