-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
Bump compatible rest api version to 9/8 #113151
Conversation
RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withHeaders( | ||
Map.of("Content-Type", contentTypeHeader, "Accept", contentTypeHeader) | ||
).withMethod(RestRequest.Method.GET).withPath("/some_index/_search").withParams(params).build(); | ||
RestRequest request = new FakeRestRequest.Builder(xContentRegistry()).withMethod(RestRequest.Method.GET) |
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.
these tests look like the explicit headers was just a copy/paste and not relevant to the thing it is actually testing.
Pinging @elastic/es-delivery (Team:Delivery) |
@elastic/ml-core - the changes here impact your code base the most. Can you please review the changes to ml and approve this PR. |
@@ -159,7 +164,9 @@ public void writeTo(StreamOutput out) throws IOException { | |||
out.writeString(path); | |||
out.writeCollection(parameters, StreamOutput::writeString); | |||
out.writeCollection(capabilities, StreamOutput::writeString); | |||
out.writeVInt(restApiVersion.major); | |||
// Fixme: lies! all lies! | |||
out.writeVInt(8); |
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.
We need to decide what to do when asked the capabilities of a mixed v8/v9 cluster and a v9 rest api - probably to check the transport versions/available rest API versions beforehand, and answer the check before querying any of the nodes if it cannot be supported (there's several other similar capabilities optimisations to do too).
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.
@thecoop - are you OK with how it is for this PR and address the proper fix later ?
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.
Yes, this can be merged as-is - the @UpdateForV9
will prompt us to fix it later
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.
The changes to the ml plugin and text_structure plugin LGTM
This commit bumps the REST API version from 8 to 9. This effectively removes all support for REST API compatibility with version 7 (though earlier commits already chipped away at some v7 support).
This also enables REST API compatibility support for version 8, providing support for v8 compatibility headers, i.e. "application/vnd.elasticsearch+json;compatible-with=8" and no-op support (no errors) to accept v9 compatibility headers i.e. "application/vnd.elasticsearch+json;compatible-with=9".
In addition to 8->9 version bump, the following was also necessary:
RouteBuilder.deprecateAndKeep
to allow us to deprecate an HTTP route/path without explicitly removing it. Prior to this commit, theRouteBuilder.deprecated
was ambiguous in what it really meant. Technically, it meant to deprecate that route/path in the expressed Rest API version, and require the compatibility headers in the next version. For example:Means that _foo/bar is available is v8 and will emit a deprecation warning, but is only accessible in v9 by using the special compatibility header. The usage hints at an expectation that the route would not be removed.
It is not clear if the intent was to simply emit deprecation warnings, or if the intent was to emit deprecation warning AND remove in the next version. To avoid removing many API's by simply bumping the REST API version; this commit introduces
RouteBuilder.deprecateAndKeep
to allow us to deprecate an HTTP route/path without explicitly removing it. All uses of.deprecated
where the version isRestApiVersion.V_8
have been updated toRouteBuilder.deprecateAndKeep
with an annotation and comment to revisit if the intent was to actually remove the API or only emit deprecation warnings. This commit will not result in removal of an APIs and allows them to continue to function as they have.The following classes have been updated and annotated to use
RouteBuilder.deprecateAndKeep
:Owner's of these classes will need to revisit the code after this commit (may also require updates to tests). cc @elastic/es-data-management @elastic/ml-core
This commit will remove support for elder name of
inference_threads/threads_per_allocation
and the elder name ofmodel_threads/number_of_allocations
HTTP parameters, unless the compatibility header is used. Note - serverless does not use compatibility headers, so the elder name will effectively be removed from serverless. cc: @elastic/ml-coreRemoval of any unit test that was testing v7 compatibility. This is needed to get the build to pass, and these tests are no longer relevant.
Skipping indices.create/synthetic_source*.yml compatible REST tests, they will not pass. This is likely due to differences between 8.x and main branches. An internal ticket ES-9597 has been logged to address. cc: @elastic/es-storage-engine
The capabilities API serialization has been hard coded to RestAPI version 8. This serialization does not guard against serializing to elder 8.x clusters that don't understand
9
. cc: @elastic/es-core-infraAny hard coded version of
7
have been updated to8
and any8'
updated to9
-> these tests are typically just ensuring we can parse values correctly.A very weird edge for testing where the routes registered, which change based on the RestAPI version, influence the response codes which can fail tests. Comments added in the source code, but some test clean up accidentally relies on some deep implementation details w.r.t. the response code to determine success or failure of the clean up step.