-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Introduce flag for testing CCS compatibility #81809
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
Conversation
CCS works with a subset of APIs and features depending on the versions of the clusters being communicated with. Currently we limit this CCS compliance to one minor version backward and one minor forward. This change adds a flag that can be turned on to test if a request sent to one of the endpoints that are supporting CCS is serializable to a cluster that is on one minor version backward. We do this by trying to serialize the request to a steam with that earlier version. Features and components that are not supported in that version should throw errors upon atempted serialization to indicate they are not compatible with that version. In addition we need components extending NamedWriteable (e.g. new queries) to also error when they are written to a stream that has a version before the version they are released in.
Caveat: I didn't add checks to the QL rest endpoints and the Vector tile search search yet, althought they are mentioned in the supported APIs because I want to discuss with the respective teams first. |
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.
I did a first pass and left some comments. The approach looks correct to me.
.../lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/common/io/stream/NamedWriteable.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/common/io/stream/VersionCheckingStreamOutput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/rest/action/search/CCSVersionCheckHelper.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/rest/action/search/CCSVersionCheckHelper.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/rest/action/search/CCSVersionCheckHelper.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/common/io/stream/VersionCheckingStreamOutput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/rest/action/search/CCSVersionCheckHelper.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/rest/action/search/RestSearchActionTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/rest/action/search/RestSearchActionTests.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/common/io/stream/VersionCheckingStreamOutput.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/rest/action/search/CCSVersionCheckHelper.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/rest/action/search/RestSearchActionTests.java
Outdated
Show resolved
Hide resolved
Pinging @elastic/es-search (Team:Search) |
Heads up to @elastic/kibana-operations and @stacey-gammon that this PR is merged now and starting with 8.1 you should be able to set the 'search.check_ccs_compatibility' setting in the config of a test cluster to enable the CCS compatibility checks on the coordinating node. Since we had no new features added since 8.0 we don't espect any errors when the setting is activated, please let us know if you have questions or once you start using this for testing. |
In elastic#81809 we introduced a mechanism to check searializability of search request to earlier version nodes already on the coordinating node. This requires knowledge about the version that NamedWritable classes have been introduced, which is why we started moving classes that are used inside the search request under the VersionedNamedWriteable interface to make sure future additions implement the mthod that provides the version information. This change moves ScoreFunctionBuilders which are used in function score queries under that interface. Since all these builders have been around before 7.0 we return the empty version constant for them.
In #81809 we introduced a mechanism to check searializability of search request to earlier version nodes already on the coordinating node. This requires knowledge about the version that NamedWritable classes have been introduced, which is why we started moving classes that are used inside the search request under the VersionedNamedWriteable interface to make sure future additions implement the mthod that provides the version information. This change moves ScoreFunctionBuilders which are used in function score queries under that interface. Since all these builders have been around before 7.0 we return the empty version constant for them.
Supporting #81809, we changed query builders to implement 'VersionedNamedWriteable' to be able to detect when new query builders under the search enpoint are introduced and also to force new implementations to overwrite 'getMinimalSupportedVersion' with a current release version. This change removes the default implementation in the QueryBuilder interface and replaces it with individual implementations in the currently existing query builders. For builders that have been around for longer than 7.0 (the earliest verison constant we currently have around) we use Version.V_EMPTY which sorts always before any other declared version.
In elastic#81809 we introduced a mechanism to check searializability of search request to earlier version nodes already on the coordinating node. This requires knowledge about the version that NamedWritable classes have been introduced, which is why we started moving classes that are used inside the search request under the VersionedNamedWriteable interface to make sure future additions implement the mthod that provides the version information. This change moves aggregation builders under that interface. Most builders have been around long before version 7.0, so we return an empty version tag for them. The newer ones return the version they were first released in.
In #81809 we introduced a mechanism to check searializability of search request to earlier version nodes already on the coordinating node. This requires knowledge about the version that NamedWritable classes have been introduced, which is why we started moving classes that are used inside the search request under the VersionedNamedWriteable interface to make sure future additions implement the mthod that provides the version information. This change moves aggregation builders under that interface. Most builders have been around long before version 7.0, so we return an empty version tag for them. The newer ones return the version they were first released in.
In #81809 we introduced a mechanism to check searializability of search request to earlier version nodes already on the coordinating node. This requires knowledge about the version that NamedWritable classes have been introduced, which is why we started moving classes that are used inside the search request under the VersionedNamedWriteable interface to make sure future additions implement the mthod that provides the version information. This change moves pipeline aggregation builders under that interface. Most builders have been around long before version 7.0, so we return an empty version tag for them. The newer ones return the version they were first released in.
In elastic#81809 we introduced a mechanism to check searializability of search request to earlier version nodes already on the coordinating node. This requires knowledge about the version that NamedWritable classes have been introduced, which is why we started moving classes that are used inside the search request under the VersionedNamedWriteable interface to make sure future additions implement the mthod that provides the version information. This change moves the InferenceConfigUpdate and implementing classes under that sub-interface. I have used the versions they were first released in looking at the pull requests that introduced the classes.
In #81809 we introduced a mechanism to check searializability of search request to earlier version nodes already on the coordinating node. This requires knowledge about the version that NamedWritable classes have been introduced, which is why we started moving classes that are used inside the search request under the VersionedNamedWriteable interface to make sure future additions implement the mthod that provides the version information. This change moves the InferenceConfigUpdate and implementing classes under that sub-interface. I have used the versions they were first released in looking at the pull requests that introduced the classes.
CCS works with a subset of APIs and features depending on the versions of the clusters being communicated with.
Currently we limit this CCS compliance to one minor version backward and one minor forward.
This change adds a setting useful for testing in clients like Kibana that can be turned on to check if a search request
sent to one of the endpoints that are supporting CCS is compatible with a cluster that is on one minor version back.
We do this by trying to serialize the request to a stream with the earlier version. Features and components that are
not supported in that version should throw errors upon atempted serialization to indicate they are not compatible.
In addition we need components extending NamedWriteable (e.g. new queries) to also error when they are written to a
stream that has a version before the version they were released.