Skip to content

Commit ec40b57

Browse files
committed
Merge branch '7.x' into docker-from-artifacts-7.x
* 7.x: Make qa/full-cluster-restart tests pass. By fixing a helper method and (elastic#38604) Mute failing WatchStatusIntegrationTests (elastic#38621) Mute failing ApiKeyIntegTests (elastic#38614) [DOCS] Add warning about bypassing ML PUT APIs (elastic#38605) Mute RetentionLeastIT.testRetentionLeasesSyncOnRecovery on 7x (elastic#38597) Only "include_type_name" if running on >= 7 (elastic#38594) Fix version logic when bumping major version (elastic#38593)
2 parents bd24fbb + b284fed commit ec40b57

File tree

9 files changed

+59
-10
lines changed

9 files changed

+59
-10
lines changed

buildSrc/src/main/java/org/elasticsearch/gradle/VersionCollection.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,14 @@ private String getGradleProjectNameFor(Version version) {
218218
private String getBranchFor(Version version) {
219219
switch (getGradleProjectNameFor(version)) {
220220
case "minor":
221-
return version.getMajor() + ".x";
221+
// The .x branch will always point to the latest minor (for that major), so a "minor" project will be on the .x branch
222+
// unless there is more recent (higher) minor.
223+
final Version latestInMajor = getLatestVersionByKey(groupByMajor, version.getMajor());
224+
if (latestInMajor.getMinor() == version.getMinor()) {
225+
return version.getMajor() + ".x";
226+
} else {
227+
return version.getMajor() + "." + version.getMinor();
228+
}
222229
case "staged":
223230
case "maintenance":
224231
case "bugfix":
@@ -234,7 +241,15 @@ public List<Version> getUnreleased() {
234241
unreleased.add(currentVersion);
235242

236243
// the tip of the previous major is unreleased for sure, be it a minor or a bugfix
237-
unreleased.add(getLatestVersionByKey(this.groupByMajor, currentVersion.getMajor() - 1));
244+
final Version latestOfPreviousMajor = getLatestVersionByKey(this.groupByMajor, currentVersion.getMajor() - 1);
245+
unreleased.add(latestOfPreviousMajor);
246+
if (latestOfPreviousMajor.getRevision() == 0) {
247+
// if the previous major is a x.y.0 release, then the tip of the minor before that (y-1) is also unreleased
248+
final Version previousMinor = getLatestInMinor(latestOfPreviousMajor.getMajor(), latestOfPreviousMajor.getMinor() - 1);
249+
if (previousMinor != null) {
250+
unreleased.add(previousMinor);
251+
}
252+
}
238253

239254
final Map<Integer, List<Version>> groupByMinor = getReleasedMajorGroupedByMinor();
240255
int greatestMinor = groupByMinor.keySet().stream().max(Integer::compareTo).orElse(0);
@@ -262,6 +277,13 @@ public List<Version> getUnreleased() {
262277
);
263278
}
264279

280+
private Version getLatestInMinor(int major, int minor) {
281+
return groupByMajor.get(major).stream()
282+
.filter(v -> v.getMinor() == minor)
283+
.max(Version::compareTo)
284+
.orElse(null);
285+
}
286+
265287
private Version getLatestVersionByKey(Map<Integer, List<Version>> groupByMajor, int key) {
266288
return groupByMajor.getOrDefault(key, emptyList()).stream()
267289
.max(Version::compareTo)

buildSrc/src/test/java/org/elasticsearch/gradle/VersionCollectionTests.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,10 @@ public void testGetUnreleased() {
282282
asList("7.1.1", "7.2.0", "7.3.0", "8.0.0"),
283283
getVersionCollection("8.0.0").getUnreleased()
284284
);
285+
assertVersionsEquals(
286+
asList("6.6.1", "6.7.0", "7.0.0", "7.1.0"),
287+
getVersionCollection("7.1.0").getUnreleased()
288+
);
285289
}
286290

287291
public void testGetBranch() {
@@ -298,13 +302,17 @@ public void testGetBranch() {
298302
getVersionCollection("6.4.2")
299303
);
300304
assertUnreleasedBranchNames(
301-
asList("5.6", "6.4", "6.x"),
305+
asList("5.6", "6.4", "6.5"),
302306
getVersionCollection("6.6.0")
303307
);
304308
assertUnreleasedBranchNames(
305309
asList("7.1", "7.2", "7.x"),
306310
getVersionCollection("8.0.0")
307311
);
312+
assertUnreleasedBranchNames(
313+
asList("6.6", "6.7", "7.0"),
314+
getVersionCollection("7.1.0")
315+
);
308316
}
309317

310318
public void testGetGradleProjectName() {
@@ -329,7 +337,7 @@ public void testGetGradleProjectName() {
329337
getVersionCollection("8.0.0")
330338
);
331339
assertUnreleasedGradleProjectNames(
332-
asList("staged", "minor"),
340+
asList("maintenance", "staged", "minor"),
333341
getVersionCollection("7.1.0")
334342
);
335343
}

docs/reference/ml/apis/put-datafeed.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ Instantiates a {dfeed}.
1919
You must create a job before you create a {dfeed}. You can associate only one
2020
{dfeed} to each job.
2121

22+
IMPORTANT: You must use {kib} or this API to create a {dfeed}. Do not put a {dfeed}
23+
directly to the `.ml-config` index using the Elasticsearch index API.
24+
If {es} {security-features} are enabled, do not give users `write`
25+
privileges on the `.ml-config` index.
26+
2227

2328
==== Path Parameters
2429

docs/reference/ml/apis/put-job.asciidoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ Instantiates a job.
1212

1313
`PUT _ml/anomaly_detectors/<job_id>`
1414

15-
//===== Description
15+
===== Description
16+
17+
IMPORTANT: You must use {kib} or this API to create a {ml} job. Do not put a job
18+
directly to the `.ml-config` index using the Elasticsearch index API.
19+
If {es} {security-features} are enabled, do not give users `write`
20+
privileges on the `.ml-config` index.
21+
1622

1723
==== Path Parameters
1824

qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,7 @@ public void testRecovery() throws Exception {
843843
* old and new versions. All of the snapshots include an index, a template,
844844
* and some routing configuration.
845845
*/
846+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/38603")
846847
public void testSnapshotRestore() throws IOException {
847848
int count;
848849
if (isRunningAgainstOldCluster() && getOldClusterVersion().major < 8) {
@@ -909,8 +910,8 @@ public void testSnapshotRestore() throws IOException {
909910
createTemplateRequest.setJsonEntity(Strings.toString(templateBuilder));
910911

911912
// In 7.0, type names are no longer expected by default in put index template requests.
912-
// We therefore use the deprecated typed APIs when running against the current version.
913-
if (isRunningAgainstAncientCluster()) {
913+
// We therefore use the deprecated typed APIs when running against the current version, but testing with a pre-7 version
914+
if (isRunningAgainstOldCluster() == false && getOldClusterVersion().major < 7) {
914915
createTemplateRequest.addParameter(INCLUDE_TYPE_NAME_PARAMETER, "true");
915916
}
916917
createTemplateRequest.setOptions(allowTypeRemovalWarnings());
@@ -1214,7 +1215,7 @@ private void saveInfoDocument(String type, String value) throws IOException {
12141215
private String loadInfoDocument(String type) throws IOException {
12151216
Request request = new Request("GET", "/info/" + this.type + "/" + index + "_" + type);
12161217
request.addParameter("filter_path", "_source");
1217-
if (isRunningAgainstAncientCluster()) {
1218+
if (getOldClusterVersion().before(Version.V_6_7_0)) {
12181219
request.setOptions(expectWarnings(RestGetAction.TYPES_DEPRECATION_MESSAGE));
12191220
}
12201221
String doc = toStr(client().performRequest(request));

server/src/test/java/org/elasticsearch/index/seqno/RetentionLeaseIT.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ public void testBackgroundRetentionLeaseSync() throws Exception {
260260
}
261261
}
262262

263+
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/38588")
263264
public void testRetentionLeasesSyncOnRecovery() throws Exception {
264265
final int numberOfReplicas = 2 - scaledRandomIntBetween(0, 2);
265266
internalCluster().ensureAtLeastNumDataNodes(1 + numberOfReplicas);

test/framework/src/main/java/org/elasticsearch/test/VersionUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public class VersionUtils {
4343
* rules here match up with the rules in gradle then this should
4444
* produce sensible results.
4545
* @return a tuple containing versions with backwards compatibility
46-
* guarantees in v1 and versions without the guranteees in v2
46+
* guarantees in v1 and versions without the guarantees in v2
4747
*/
4848
static Tuple<List<Version>, List<Version>> resolveReleasedVersions(Version current, Class<?> versionClass) {
4949
// group versions into major version
@@ -67,7 +67,11 @@ static Tuple<List<Version>, List<Version>> resolveReleasedVersions(Version curre
6767
// on a stable or release branch, ie N.x
6868
stableVersions = currentMajor;
6969
// remove the next maintenance bugfix
70-
moveLastToUnreleased(previousMajor, unreleasedVersions);
70+
final Version prevMajorLastMinor = moveLastToUnreleased(previousMajor, unreleasedVersions);
71+
if (prevMajorLastMinor.revision == 0 && previousMajor.isEmpty() == false) {
72+
// The latest minor in the previous major is a ".0" release, so there must be an unreleased bugfix for the minor before that
73+
moveLastToUnreleased(previousMajor, unreleasedVersions);
74+
}
7175
}
7276

7377
// remove next minor

x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/ApiKeyIntegTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ public void testInvalidateApiKeysForApiKeyName() throws InterruptedException, Ex
237237
verifyInvalidateResponse(1, responses, invalidateResponse);
238238
}
239239

240+
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/38408")
240241
public void testGetAndInvalidateApiKeysWithExpiredAndInvalidatedApiKey() throws Exception {
241242
List<CreateApiKeyResponse> responses = createApiKeys(1, null);
242243
Instant created = Instant.now();

x-pack/plugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/watch/WatchStatusIntegrationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
public class WatchStatusIntegrationTests extends AbstractWatcherIntegrationTestCase {
2626

27+
@AwaitsFix(bugUrl="https://github.com/elastic/elasticsearch/issues/38619")
2728
public void testThatStatusGetsUpdated() {
2829
WatcherClient watcherClient = watcherClient();
2930
watcherClient.preparePutWatch("_name")

0 commit comments

Comments
 (0)