Skip to content

Filter out older versions when running bwc tests on aarch64 (#68532) (7.x backport) #69330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 20 additions & 13 deletions buildSrc/src/main/java/org/elasticsearch/gradle/BwcVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@

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

/**
* Returns info about the unreleased version, or {@code null} if the version is released.
*/
* Returns info about the unreleased version, or {@code null} if the version is released.
*/
public UnreleasedVersionInfo unreleasedInfo(Version version) {
return unreleased.get(version);
}
Expand Down Expand Up @@ -330,16 +330,17 @@ private List<Version> getReleased() {

public List<Version> getIndexCompatible() {
return unmodifiableList(
Stream.concat(groupByMajor.get(currentVersion.getMajor() - 1).stream(), groupByMajor.get(currentVersion.getMajor()).stream())
.filter(version -> version.equals(currentVersion) == false)
.collect(Collectors.toList())
filterSupportedVersions(
Stream.concat(
groupByMajor.get(currentVersion.getMajor() - 1).stream(),
groupByMajor.get(currentVersion.getMajor()).stream()
).filter(version -> version.equals(currentVersion) == false).collect(Collectors.toList())
)
);

}

public List<Version> getWireCompatible() {
List<Version> wireCompat = new ArrayList<>();

List<Version> prevMajors = groupByMajor.get(currentVersion.getMajor() - 1);
int minor = prevMajors.get(prevMajors.size() - 1).getMinor();
for (int i = prevMajors.size() - 1; i > 0 && prevMajors.get(i).getMinor() == minor; i--) {
Expand All @@ -349,7 +350,13 @@ public List<Version> getWireCompatible() {
wireCompat.remove(currentVersion);
wireCompat.sort(Version::compareTo);

return unmodifiableList(wireCompat);
return unmodifiableList(filterSupportedVersions(wireCompat));
}

private List<Version> filterSupportedVersions(List<Version> wireCompat) {
return Architecture.current() == Architecture.AARCH64
? wireCompat.stream().filter(version -> version.onOrAfter("7.12.0")).collect(Collectors.toList())
: wireCompat;
}

public List<Version> getUnreleasedIndexCompatible() {
Expand Down