Skip to content
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

Changes about Version/IndexVersion as part of removing occurrences of @UpdateForV9 (ES-9378) #119101

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

alexey-ivanov-es
Copy link
Contributor

No description provided.

…removing all occurrences of the Java annotation @UpdateForV9 (ES-9378)
}
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 "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
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