-
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
Get Aliases with wildcard exclusion expression #34230
Get Aliases with wildcard exclusion expression #34230
Conversation
Pinging @elastic/es-core-infra |
Thanks a lot for your effort @albertzaharovits and the super clear description! I haven't reviewed this thoroughly yet, but given that we are breaking the behaviour of get aliases API in some circumstances in order to fix a bug, I wonder if it's worth starting the discussion on #30536 with the team, just to make sure that we move in the right direction long-term. Also, I believe aliases exclusions were not released yet, so we can always consider to back them off of 6.5 while we figure out what to do with get aliases (though this sounds a bit extreme). Would it be possible to have a couple of examples about the scenarios affected by the breakage, and the difference before and after the change? We may also come to the conclusion that it's not that bad. |
Thanks for the speedy feedback @javanna ! I will add a description of the problem about missing Another thing I just realized is that the REST tests I have |
@albertzaharovits - What do you need to move this PR forward ? Also, is this breaking change ? |
Hi @jakelandis
A review :)
Yes, wildcards that are not present in the response will not be reported as missing anymore.
|
Jenkins retest this please |
heya @albertzaharovits thanks for updating the description, could you also add some examples about the scenarios affected by the breakage please, with responses before and after your change? Although it's a bug-fix, I guess we need to document the breakage somewhere? |
Hi @javanna , What this changes is the response of the get alias request. From what I can tell, It is not described (documented) anywhere (though it is parsed by yml REST tests), this is why I have not described the breaking behavior in the documentation.
As you can see, the breaking change is that |
run gradle build tests 1 |
https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+pull-request-2/5210/console
run gradle build tests 2 |
run gradle build tests 2 |
Probably tracked by #37684 (comment) run gradle build tests 1 |
run gradle build tests 1 |
@elasticmachine run elasticsearch-ci/1 |
https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+pull-request-2/5654/consoleFull
@elasticmachine run elasticsearch-ci/2 |
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 am good with the change, I don't think we can avoid the breakage and it's not a big deal. I do wish that we went forward discussing #30536 meanwhile, given that this PR was first opened months ago. Can that be discussed at some point soon? Thanks for fixing this!!
if (Regex.simpleMatch(pattern, aliasName)) { | ||
matches.add(pattern); | ||
continue outer; | ||
// compute explicitly requested aliases that have are not returned in the result |
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.
it would be great to have a unit test for this code. Otherwise we only rely on yaml tests to test it. Could be done as a followup.
@javanna I have added the unit tests https://github.com/elastic/elasticsearch/pull/34230/files#diff-a4a22111aebdc6f8578f82fdf9bd5617 They test the alias wildcard logic in the scope of this PR. |
This commit adds the code in the HTTP layer that will parse exclusion wildcard expressions. The existing code issues 404s for wildcards as well as explicit indices. But, in general, in an expression with exclude wildcards (-...*) following other include wildcards, there is no way to tell if the include wildcard produced no results or they were subsequently excluded. Therefore, the proposed change is breaking the behavior of 404s for wildcards. Specifically, no 404s will be returned for wildcards, even if they are not followed by exclude wildcards or the exclude wildcards could not possibly exclude what has previously been included. Only explicitly requested aliases will be called out as missing.
#33518 added support for wildcard expressions for aliases resolution.
However, the REST handler will re-parse the expression on its own to
identify aliases missing from the response and issue a 404 and message.
This logic does not deal with wildcard exclusions (
-...*
). Consequently,extraneous 404s were returned for aliases that were truthfully excluded,
as opposed to be missing.
Example:
The result is correct but the 404 is not.
This PR adds the code in the REST layer that will parse exclusion wildcard
expressions, together with REST tests.
The existing code issued 404s for wildcards as well as explicit indices.
In an expression with exclude wildcards (
-...*
)followed byfollowing wildcards,there is no way to tell if the include wildcard produced no results or
they were subsequently excluded (in the general case).
Therefore, the proposed change is breaking the behavior of 404s for
wildcards. Specifically, no 404s will be returned for wildcards, even
if they are not followed by exclude wildcards or the exclude wildcards
could not possibly exclude what has previously been included.
Depends on: #34144
Relates: #33805