Always error out if CCS expression shows up when CCS is not supported#139009
Always error out if CCS expression shows up when CCS is not supported#139009smalyshev merged 37 commits intoelastic:mainfrom
Conversation
|
Hi @smalyshev, I've created a changelog YAML for you. |
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
|
Hi @smalyshev, I've updated the changelog YAML for you. |
I totally understand your concern. You can use this API in a variety of ways though. The thing is, if you pass a remote index to it, it is supposed to throw. And it will never resolve it properly. The latter has always been the case, so if some API uses it and expects it to resolve remote indices, it is already broken. Fortunately, I didn't and the tests do not reveal any cases where it really happens - except maybe Now, can there be more corner cases where other APIs are relying on the same thing and aren't covered by tests? There could be. But that means they are already broken now, and the only way we can detect it (instead of users just silently getting wrong results in their responses) is to provide an identifiable error where it happens, and then when this error pops up, fix it. Short of reimplementing |
I am not saying that this "ignoring of remote indices" behaviour was tested and documented, but it is how it has been working and in the code it looked like a conscious choice. We can revise that choice (fwiw I also find it cleaner to consider this behaviour a bug). However, because it is working like this now, and it is possible that users might have remote expressions that have flew under the radar because of |
@gmarouli - I created the issue for this as a bug, not a breaking change, after discussing it with Najwa and Jason Tedor. Given the surface area of the change that you and Stas are highlighting here, I spoke with Jason again today about it and our question is - is there a usage from a user that wouldn't be considered incorrect behavior to start with? For example, are all the cases where users would now start getting an error (with this code change) ones where they are referencing a remote index in an endpoint that is not cross-cluster enabled, such as |
|
Hi @smalyshev, I've updated the changelog YAML for you. |
I do not know why this was implemented like this and there were no documented use cases in the code as far as I know. I do not know what we have communicated to the users about this either. So, my answer is I do not know, and I do not have someone in mind to redirect you to.
I doubt this, but I cannot say it with certainty. In the past when fixing a bug that would change a silent fail to an error, we considered the element of surprise to some users, and that could influence the choice of fixing the bug or letting it be. This is what I am asking, to double check that the benefit of fixing this behaviour outweighs the possibility of surprising some users. |
gmarouli
left a comment
There was a problem hiding this comment.
Apologies for the late code review, I thought I had submitted it 😶🌫️
server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java
Outdated
Show resolved
Hide resolved
| public static final NodeFeature SEARCH_WITH_NO_DIMENSIONS_BUGFIX = new NodeFeature("search.vectors.no_dimensions_bugfix"); | ||
| public static final NodeFeature SEARCH_RESCORE_SCRIPT = new NodeFeature("search.rescore.script"); | ||
| public static final NodeFeature NEGATIVE_FUNCTION_SCORE_BAD_REQUEST = new NodeFeature("search.negative.function.score.bad.request"); | ||
| public static final NodeFeature INDICES_BOOST_REMOTE_INDEX_FIX = new NodeFeature("search.indices_boost_remote_index_fix"); |
There was a problem hiding this comment.
All the APIs that use index resolution? Or can use index boosts?
I was referring to the APIs that use index resolution but their behaviour changes with this.
That could be a lot of them, and I am not sure how to practically do that.
Considering that this is only relevant for testing, so I would add it to the APIs you are testing, in this case the mapping, the index boosts and any other you choose to test.
Unless I am mistaken API capabilities were the recommended way to capture API (and behaviour) changes. Do you think that's not the case?
|
|
||
| /** | ||
| * Filter out remote index expressions. | ||
| * TODO: SQL Metadata commands currently do not support remote indices. |
There was a problem hiding this comment.
Do we need to handle this in this PR? If not, how urgent is the follow-up?
There was a problem hiding this comment.
The tests in x-pack/plugin/sql/qa/server/src/main/resources/multi-cluster-with-security/multi-cluster-command-sys.csv-spec do not support remote aliases, so I don't think we need to fix it here. As for fixing it in general, I think we need to ask the Analytics team, but given as it has been there for a while and nobody complained, it's probably not very high priority.
quux00
left a comment
There was a problem hiding this comment.
LGTM. Let's go ahead with merging.
* upstream/main: (191 commits) Overall Decision for Deciders prioritizes THROTTLE (elastic#140237) Apply group by all logic not only to top-level aggregates (elastic#140248) [ES|QL] Refactor MV_UNION and MV_INTERSECTION to use shared set operation helper (elastic#139982) Avoid reading entire bloom filter file on reader open (elastic#139374) Mark bloom filter files for random access (elastic#139375) Ensure that the buffer used for ES93BloomFilterStoredFieldsFormat is zeroed (elastic#139034) Add busy assertion to avoid race condition for testStalledShardMigrationProperlyDetected (elastic#140230) Remove line number check for testTransitiveFindsDeepCallChain (elastic#140228) Allow a slight difference in rescored docs (elastic#139931) Mute org.elasticsearch.xpack.inference.integration.AuthorizationTaskExecutorIT testCreatesEisChatCompletion_DoesNotRemoveEndpointWhenNoLongerAuthorized elastic#138480 Start exchange sink fetchers concurrently (elastic#140196) Allow allocation to replacement target node on vacate completion (elastic#140150) Ignore JNA cleaner threads in SecureHdfsRepositoryAnalysisRestIT (elastic#139925) DeterministicQueue refactor and enhancement (elastic#140151) Always error out if CCS expression shows up when CCS is not supported (elastic#139009) Use IllegalArgumentException over RepositoryException for readonly-repository checks (elastic#140200) Guard promql capabilities in AnalyzerTests (elastic#140232) [Inference API] Fix flaky AuthorizationTaskExecutorIT tests (elastic#139978) Cleaning up exitable vector value impls (elastic#140190) [Inference API] Fix auth exception listener not called bug (elastic#139966) ...
…elastic#139009) * Always error out if CCS expression shows up when CCS is not supported
This patch decouples
ignore_unavailablefrom "CCS not supported" error when trying to resolve index expression.IndexNameExpressionResolvercan not resolve remote expressions, and for most code paths, it is the right thing to return an error when such expression is supplied. For some code paths, it may be OK to ignore such expressions, at least for now, but in either case,ignore_unavailableshould have nothing to do with it.This patch tries to preserve the functionality in most places which misuse
IndexNameExpressionResolverby trying to sent it remote indices, but we'd need to go back and fix those eventually.Closes: #138987