Skip to content
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

Disallow explicitly requesting system indices in snapshots #81235

Conversation

gwbrown
Copy link
Contributor

@gwbrown gwbrown commented Dec 1, 2021

This commit changes SnapshotsService to throw an error when a
system index is explicitly requested, rather than silently
dropping it, and adds a test to verify that behavior.

Note that only system indices requested by full name return
an error, requesting e.g. "indices": ".geo*" (which would normally resolve to
.geoip_databases) does not include its system index and does not
error, but requesting "indices": ".geoip_databases" will return
an error.

Follow-up to #79670


This should have been part of the original change - I thought we had already done this, but @jrodewig pointed out to me that it silently dropped system indices instead.

This commit changes SnapshotsService to throw an error when a
system index is explicitly requested, rather than silently
dropping it, and adds a test to verify that behavior.
@gwbrown gwbrown added >non-issue :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v8.0.0 v8.1.0 labels Dec 1, 2021
@elasticmachine elasticmachine added the Team:Distributed Meta label for distributed team label Dec 1, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

Copy link
Contributor

@jrodewig jrodewig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally and it works. LGTM.

Comment on lines 320 to 321
"system indices [{}] were explicitly requested, but snapshots should use the "
+ "[include_global_state] or [feature_states] parameters to control inclusion of system indices",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker, but we may want to mention the indices parameter here. Right now, it can be a little unclear where the error is coming from. I'd suggest something like:

The [indices] parameter includes system indices [{}]. To include system indices in a snapshot, use the [include_global_state] or [feature_states] parameters instead.

It'd be great if we could somehow surface this error for SLM policies too (either at policy creation/update or execution), but that's likely outside of scope here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened an issue for detecting this in SLM policies at #81319.

I'll make the wording change to the message, thanks!

Copy link
Contributor

@williamrandolph williamrandolph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@gwbrown gwbrown changed the title Disallow explicitly requesting system indices Disallow explicitly requesting system indices in snapshots Dec 3, 2021
@gwbrown gwbrown added auto-backport-and-merge Automatically create backport pull requests and merge when ready auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Dec 3, 2021
@elasticsearchmachine elasticsearchmachine merged commit a2e5b14 into elastic:master Dec 4, 2021
gwbrown added a commit to gwbrown/elasticsearch that referenced this pull request Dec 4, 2021
…1235)

This commit changes SnapshotsService to throw an error when a system
index is explicitly requested, rather than silently dropping it, and
adds a test to verify that behavior. Note that *only* system indices
requested by full name return an error, requesting e.g. `"indices":
".geo*"` (which would normally resolve to `.geoip_databases`) does not
include its system index and does not error, but requesting `"indices":
".geoip_databases"` *will* return an error. Follow-up to elastic#79670 --- This
should have been part of the original change - I thought we had already
done this, but @jrodewig pointed out to me that it silently dropped
system indices instead.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.0

elasticsearchmachine pushed a commit that referenced this pull request Dec 4, 2021
…81346)

This commit changes SnapshotsService to throw an error when a system
index is explicitly requested, rather than silently dropping it, and
adds a test to verify that behavior. Note that *only* system indices
requested by full name return an error, requesting e.g. `"indices":
".geo*"` (which would normally resolve to `.geoip_databases`) does not
include its system index and does not error, but requesting `"indices":
".geoip_databases"` *will* return an error. Follow-up to #79670 --- This
should have been part of the original change - I thought we had already
done this, but @jrodewig pointed out to me that it silently dropped
system indices instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-and-merge Automatically create backport pull requests and merge when ready auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >non-issue Team:Distributed Meta label for distributed team v8.0.0-rc1 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants