Skip to content

Conversation

alexey-ivanov-es
Copy link
Contributor

No description provided.

…removing all occurrences of the Java annotation @UpdateForV9 (ES-9378)
return previousNodeVersion;
}
return "7.17.0";
return BuildVersion.fromVersionId(Version.CURRENT.minimumCompatibilityVersion().id);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok to use Version here?
In previous PR: #117992 (comment)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add this to BuildVersion to avoid inferring build versions from version ids.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few nits

return previousNodeVersion;
}
return "7.17.0";
return BuildVersion.fromVersionId(Version.CURRENT.minimumCompatibilityVersion().id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add this to BuildVersion to avoid inferring build versions from version ids.

assertThat(nodeMetadata.nodeId(), equalTo("y6VUVMSaStO4Tz-B5BxcOw"));
assertThat(nodeMetadata.nodeVersion(), equalTo(BuildVersion.fromVersionId(0)));

ElasticsearchException ex = assertThrows(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertThrows comes from junit and is a bit wonky in my experience. We use expectThrows in other parts of the codebase (which is our own, and existed before junit added a method for this). Let's prefer using that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

public void testUpgradeMarksPreviousVersion() {
final String nodeId = randomAlphaOfLength(10);
final Version version = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.V_8_0_0);
final Version version = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(), Version.V_9_0_0);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this test be rewritten to be built on BuildVersion and IndexVersion? We seem to be still using Version, but NodeMetadata no longer uses that class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how to do it without big refactoring - BuildVersion currently is essentially a wrapper around Version, so it doesn't seem possible to create it without having a version id within a valid range

@alexey-ivanov-es alexey-ivanov-es changed the title Various changes about Version/IndexVersion as part of addressing and removing all occurrences of the Java annotation @UpdateForV9 (ES-9378) Changes about Version/IndexVersion as part of removing occurrences of @UpdateForV9 (ES-9378) Jan 10, 2025
@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Jan 10, 2025
* <p>If a user is trying to install 8.0 but has incompatible indices, the user should
* downgrade to 7.17.x. We return 7.17.0, unless the user is trying to upgrade from
* a 7.17.x release, in which case we return the last installed version.
* <p>If a user is trying to install 9.0 (current major) but has incompatible indices, the user should
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rewrite this in abstract terms so we don't need to update it with each major release? You could use N.0 and (N-1).last

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@rjernst
Copy link
Member

rjernst commented Jan 17, 2025

@alexey-ivanov-es Please also adjust the PR title. It should be clearer by the title what is changing. eg this seems to now be about minimum compatibility version.

@alexey-ivanov-es alexey-ivanov-es changed the title Changes about Version/IndexVersion as part of removing occurrences of @UpdateForV9 (ES-9378) Introduce minimumCompatibilityVersion to BuildVersion (ES-9378) Jan 22, 2025
@alexey-ivanov-es alexey-ivanov-es merged commit 32eada6 into elastic:main Jan 24, 2025
16 checks passed
@alexey-ivanov-es alexey-ivanov-es deleted the ES-9378_versions branch January 24, 2025 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Core Core issues without another label >refactoring serverless-linked Added by automation, don't add manually Team:Core/Infra Meta label for core/infra team v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants