Always treat dash-prefixed expression as index exclusion#138467
Always treat dash-prefixed expression as index exclusion#138467elasticsearchmachine merged 22 commits intoelastic:mainfrom
Conversation
|
Hi @ywangd, I've created a changelog YAML for you. |
🔍 Preview links for changed docs |
ℹ️ Important: Docs version tagging👋 Thanks for updating the docs! Just a friendly reminder that our docs are now cumulative. This means all 9.x versions are documented on the same page and published off of the main branch, instead of creating separate pages for each minor version. We use applies_to tags to mark version-specific features and changes. Expand for a quick overviewWhen to use applies_to tags:✅ At the page level to indicate which products/deployments the content applies to (mandatory) What NOT to do:❌ Don't remove or replace information that applies to an older version 🤔 Need help?
|
|
Hi @ywangd, I've updated the changelog YAML for you. |
This commit adds the bytes and break if we get over the limit of the breaker when building global ordinals.
| final var iter = expressions.iterator(); | ||
| while (iter.hasNext()) { | ||
| final ResolvedIndexExpression current = iter.next(); | ||
| if (expressionsToExclude.contains(current.original())) { | ||
| iter.remove(); | ||
| continue; | ||
| } | ||
| final Set<String> localExpressions = current.localExpressions().indices(); | ||
| if (localExpressions.isEmpty()) { | ||
| continue; | ||
| } |
There was a problem hiding this comment.
This change ensures that an expression like foo,bar,-foo work correctly by excluding foo entirely from the ResolvedExpressions. It is so far a CPS only feature and strictly speaking not necessary for stateful code yet. But we would have to mute or skip tests without it. So I decided to include it given the its relative small size.
|
Pinging @elastic/es-security (Team:Security) |
|
Both |
idegtiarenko
left a comment
There was a problem hiding this comment.
ES|QL will take advantage of this changes once merged as we indirectly use IndexNameExpressionResolver.
Thanks, looking forward for this change to be merged!
There was a problem hiding this comment.
A user who is snapshotting very-important-index,other-indices*,-*ant* today will, after this change, silently stop having snapshots of very-important-index. I understand that we might like to change this behaviour, even perhaps considering it a bug, but still it's a potentially-data-loss-causing breaking change that at least needs some discussion with the BCC before proceeding.
The original design in which specifically-named indices (no wildcards) are not excluded was a deliberate choice.
Indeed. There is an approval proposal for this change. I tagged you in Slack for the relevant message. Thanks for checking! |
DaveCTurner
left a comment
There was a problem hiding this comment.
Sorry, I was misreading the effects of this change, it doesn't have the impact I initially thought. I'm ok with it now, sorry for the noise.
server/src/main/java/org/elasticsearch/cluster/metadata/IndexNameExpressionResolver.java
Outdated
Show resolved
Hide resolved
Doesn't have the impact I thought it had.
docs/changelog/138467.yaml
Outdated
| @@ -0,0 +1,7 @@ | |||
| pr: 138467 | |||
| summary: "Fixed a bug that dash prefix expressions, including both concrete names\ | |||
There was a problem hiding this comment.
language nit: I'd rephrase and add examples:
Fixed a bug where dash-prefixed expressions, for both specific index names and wildcard patterns (for example: -system-index, -logs-*), were not consistently excluded during index resolution.
There was a problem hiding this comment.
Thanks for the suggestion. Updated in 1f1d757
leemthompo
left a comment
There was a problem hiding this comment.
Just couple language issues. I think the note is OK, but I'll let @DaveCTurner weigh in on whether it's clear enough to his eyes
| {applies_to}`stack: ga 9.3` A dash-prefixed (`-`) expression is always treated as an exclusion. | ||
|
|
||
| ::::{note} | ||
| In previous versions, such expression is sometimes _not_ treated as an exclusion due to a bug. |
There was a problem hiding this comment.
Can we use removed 9.3 here?
{applies_to}`stack: removed 9.3`
I think that'd be nicer than a ::::{note} which highlights this whole paragraph as if it's important.
There was a problem hiding this comment.
I think removed is aimed more at features that have been deprecated and eventually removed 🤔
Pinging the experts @florent-leborgne @shainaraskas @colleenmcginnis who will have more ideas about the appropriate pattern to use here.
nicer than a ::::{note} which highlights this whole paragraph as if it's important.
Yes, I think we could just remove the note too and that might suffice here, as the new behavior now has the applies_to tag
There was a problem hiding this comment.
I think that just pulling this out of a note would work. I think until we have ranges (eta 9.3), that's the best choice
There was a problem hiding this comment.
Thanks. I removed the note annotation as suggested fb4b24a
Co-authored-by: Liam Thompson <leemthompo@gmail.com>
leemthompo
left a comment
There was a problem hiding this comment.
Thanks for iterating on the docs!
|
Hi @ywangd, I've updated the changelog YAML for you. |
Fixed a bug that dash prefix expressions, including both concrete names and wildcard patterns, are not always treated as index exclusion during index resolution process. The PR also updates relevant document to make the behaviour clear.
Resolves: #64752
Resolves: #83435