-
Notifications
You must be signed in to change notification settings - Fork 25k
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
TransportVersionUtils#randomVersionBetween does not work with version extensions (106119) #116198
Conversation
… extensions (106119) Fixes elastic#106119
Pinging @elastic/es-core-infra (Team:Core/Infra) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically this fixes the bug, but the purpose of the function is to test (randomly) any possible version in a range. For serverless, that means more versions (potentially) Shouldn't we add the versions from the extensions instead of just adjusting the index?
@ldematte The list of versions is currently only available in a static context. Here are the options I see for making it extendable:
I feel that existing approach to version extensions is error-prone, but as we only need the list of all versions for unit tests now, I’m not sure it’s worth the effort to fix it properly. What do you think? Am I missing something? |
I was thinking about 2: using the current extension mechanism, extending it if needed. |
Could we have a There's also a question about which versions are actually 'live', which requires knowing about deployed serverless versions. Maybe we could use a hard limit - go back a maximum of 50 versions? |
++ for |
There is still the problem of unchanged tests running on the serverless codebase; even when we introduce ServerlessTransportVersionUtils, I think the change in this PR would be still needed. |
Does this solve the original problem? It seems to me that if core tests using TransportVersionUtils#randomVersionBetween are executed as part of the serverless build, then TransportVersion#current might still return a version that doesn’t exist in core
I didn’t quite understand this part. Could you clarify where this question comes up and in what context we would need to go back? |
The issue is that
1 is perhaps the more dev-friendly option, and adding another method to Additionally, we can think more about what transport versions is likely to be used in serverless whilst doing this change. Because we're always releasing off main, we don't need to test 8.1, 8.2, etc in the serverless repo. Using methods 1 or 2, we can limit the transport versions that are returned by any methods in |
f9a87e2
to
d4ab0db
Compare
server/src/main/java/org/elasticsearch/internal/VersionExtension.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, if @rjernst is also ok with it.
This does mean that TransportVersions.VERSION_IDS
will contain constants not defined in TransportVersions
, but I think thats ok given the situations that will happen in.
I don't think we should do that. Can we move the "getl all transport versions" on to |
What is the purpose of having a list of transport versions in a serverless app which doesn't include serverless versions?
I think yes. To me, |
There's some history here. TransportVersion is the "thing" that we want. It has the We created TransportVersions to avoid static initialization problems. The constants are defined separately from the type of the constants. ServerlessTransportVersions is then the serverless equivalent, where those constants are defined. The reason I think the "all" type method belongs on TransportVersion is because that is where |
Moved getAllVersions to TransportVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks pretty good. I have just a couple more thoughts.
test/framework/src/main/java/org/elasticsearch/KnownTransportVersions.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple last nits, but otherwise looks good.
💚 Backport successful
|
… extensions (106119) (elastic#116198) Introduces a new extension method to VersionExtension enabling extensions to provide additional versions and creates method TransportVersion.getAllVersions returning all transport versions defined by Elasticsearch and the extension. This ensures that TransportVersion.current() always returns the correct current (latest) transport version even if it is defined by an extension. Fixes elastic#106119
Introduces a new extension method to VersionExtension enabling extensions to provide additional versions and creates method TransportVersion.getAllVersions returning all transport versions defined by Elasticsearch and the extension. This ensures that TransportVersion.current() always returns the correct current (latest) transport version even if it is defined by an extension.
Fixes #106119