Skip to content

Commit 6e3a7b2

Browse files
authored
Filter out older versions when running bwc tests on aarch64 (#68532) (#69330)
1 parent d6537d6 commit 6e3a7b2

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

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

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828

2929
/**
3030
* A container for elasticsearch supported version information used in BWC testing.
31-
*
31+
* <p>
3232
* Parse the Java source file containing the versions declarations and use the known rules to figure out which are all
3333
* the version the current one is wire and index compatible with.
3434
* On top of this, figure out which of these are unreleased and provide the branch they can be built from.
35-
*
35+
* <p>
3636
* Note that in this context, currentVersion is the unreleased version this build operates on.
3737
* At any point in time there will surely be four such unreleased versions being worked on,
3838
* thus currentVersion will be one of these.
39-
*
39+
* <p>
4040
* Considering:
4141
* <dl>
4242
* <dt>M, M &gt; 0</dt>
@@ -56,11 +56,11 @@
5656
* <ul>
5757
* <li>the unreleased <b>staged</b>, M.N-2.0 (N &gt; 2) on the `M.(N-2)` branch</li>
5858
* </ul>
59-
*
59+
* <p>
6060
* Each build is only concerned with versions before it, as those are the ones that need to be tested
6161
* for backwards compatibility. We never look forward, and don't add forward facing version number to branches of previous
6262
* version.
63-
*
63+
* <p>
6464
* Each branch has a current version, and expected compatible versions are parsed from the server code's Version` class.
6565
* We can reliably figure out which the unreleased versions are due to the convention of always adding the next unreleased
6666
* version number to server in all branches when a version is released.
@@ -162,8 +162,8 @@ private void assertCurrentVersionMatchesParsed(Version currentVersionProperty) {
162162
}
163163

164164
/**
165-
* Returns info about the unreleased version, or {@code null} if the version is released.
166-
*/
165+
* Returns info about the unreleased version, or {@code null} if the version is released.
166+
*/
167167
public UnreleasedVersionInfo unreleasedInfo(Version version) {
168168
return unreleased.get(version);
169169
}
@@ -330,16 +330,17 @@ private List<Version> getReleased() {
330330

331331
public List<Version> getIndexCompatible() {
332332
return unmodifiableList(
333-
Stream.concat(groupByMajor.get(currentVersion.getMajor() - 1).stream(), groupByMajor.get(currentVersion.getMajor()).stream())
334-
.filter(version -> version.equals(currentVersion) == false)
335-
.collect(Collectors.toList())
333+
filterSupportedVersions(
334+
Stream.concat(
335+
groupByMajor.get(currentVersion.getMajor() - 1).stream(),
336+
groupByMajor.get(currentVersion.getMajor()).stream()
337+
).filter(version -> version.equals(currentVersion) == false).collect(Collectors.toList())
338+
)
336339
);
337-
338340
}
339341

340342
public List<Version> getWireCompatible() {
341343
List<Version> wireCompat = new ArrayList<>();
342-
343344
List<Version> prevMajors = groupByMajor.get(currentVersion.getMajor() - 1);
344345
int minor = prevMajors.get(prevMajors.size() - 1).getMinor();
345346
for (int i = prevMajors.size() - 1; i > 0 && prevMajors.get(i).getMinor() == minor; i--) {
@@ -349,7 +350,13 @@ public List<Version> getWireCompatible() {
349350
wireCompat.remove(currentVersion);
350351
wireCompat.sort(Version::compareTo);
351352

352-
return unmodifiableList(wireCompat);
353+
return unmodifiableList(filterSupportedVersions(wireCompat));
354+
}
355+
356+
private List<Version> filterSupportedVersions(List<Version> wireCompat) {
357+
return Architecture.current() == Architecture.AARCH64
358+
? wireCompat.stream().filter(version -> version.onOrAfter("7.12.0")).collect(Collectors.toList())
359+
: wireCompat;
353360
}
354361

355362
public List<Version> getUnreleasedIndexCompatible() {

0 commit comments

Comments
 (0)