-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Improve error message for search.check_ccs_compatibility=true mode flag #97059
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
Improve error message for search.check_ccs_compatibility=true mode flag #97059
Conversation
Pinging @elastic/es-search (Team:Search) |
One problem I see with the new Transport Versions and this error message is that it has become opaque to users what ES release version that maps to. Possible solutions:
Right now, it just reports:
|
I'm not concerned about that. The ccs flag itself is mostly meant for internal, pre-release usage anyway, and the details in the error mostly for ourselves getting more information for debugging. The extension to |
ex.getCause().getMessage() | ||
); | ||
|
||
String expectedCause = "[fail_before_current_version] was released first in version XXXXXXX, failed compatibility check trying to" |
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.
Can you get the failing "future" version from the FailBeforeCurrentVersionQuery test query builder? I guess getting the failing node version is more difficult, so maybe no way to get around the string replace operation here? Would be nice to avoid it but not a blocker for me.
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 added this in a new commit.
Doing that forced me to realize there is one minor problem here.
The error message has the format:
[<query_type>] was released first in version X, failed compatibility check trying to send it to node with version Y
In production settings, the version "Y" will be correct - the actual TransportVersion being used.
But for the check_ccs_compatibility=true condition, it won't actually report current TransportVersion - it will report TransportVersion.MINIMUM_CCS_VERSION, because that's what we pass into the TransportSearchHelper check method here: https://github.com/elastic/elasticsearch/blob/main/server/src/main/java/org/elasticsearch/action/search/TransportSearchHelper.java#L108
It is correct to pass in TransportVersion.MINIMUM_CCS_VERSION to do the minimal check, but the error message is then wrong - we aren't checking current version, we are checking the previous release version. So that error message could be confusing to kibana testers.
But we can't change the error message to say "minimal version" because in production it reports actual version.
So I just left it as is.
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.
Makes sense to me, I left a small question around the tests but nothing that should block from my side.
The code to have the better error message is already present. But the current tests are not set up in a way to reveal that. This adjusts the testing FailBeforeCurrentQueryBuilder to demonstrate it. To show this via manual testing, I changed the MatchAllQueryBuilder to return a TransportVersion in the future from its getMinimalSupportedVersion method. When I start elasticsearch with -E search.check_ccs_compatibility=true and do a match_all query, the response is: ``` { "error": { "root_cause": [ { "type": "illegal_argument_exception", "reason": "[class org.elasticsearch.action.search.SearchRequest] is not compatible with version 8500020 and the 'search.check_ccs_compatibility' setting is enabled. YY" } ], "type": "illegal_argument_exception", "reason": "[class org.elasticsearch.action.search.SearchRequest] is not compatible with version 8500020 and the 'search.check_ccs_compatibility' setting is enabled. YY", "caused_by": { "type": "illegal_argument_exception", "reason": "[match_all] was released first in version 8511132, failed compatibility check trying to send it to node with version 8500020" } }, "status": 400 } ``` The underlying caused_by shows the exact query (match_all) that was incompatible.
… expected error message, including Transport versions
b8da0a5
to
0b45cd5
Compare
The code to have the better error message is already present. But the current tests are not set up in a way to reveal that. This commit adjusts the testing FailBeforeCurrentQueryBuilder to demonstrate that the useful error messages are present.
To show this via manual testing, I changed the MatchAllQueryBuilder to return a TransportVersion in the future from its getMinimalSupportedVersion method.
When I start elasticsearch with
-E search.check_ccs_compatibility=true
and do a match_all query, the response is:The reason in the cause_by section shows which query failed and why (which version it was introduced in) compared to the version being used by the cluster being queried.
Closes #85487