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

Enforce data_frozen for partial searchable snapshot _tier_preference #71155

Merged
merged 7 commits into from
Apr 6, 2021

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Mar 31, 2021

We already set data_frozen for partial searchable snapshots when they are mounted (#70786), and
automatically convert values other than the frozen role automatically for these snapshots when the
metadata is loaded (#71014). This commit makes the _tier_preference setting validate that the
setting is only data_frozen when set on a partial searchable snapshot index.

We already set `data_frozen` for partial searchable snapshots when they are mounted (elastic#70786), and
automatically convert values other than the frozen role automatically for these snapshots when the
metadata is loaded (elastic#71014). This commit makes the `_tier_preference` setting validate that the
setting is *only* `data_frozen` when set on a partial searchable snapshot index.
@dakrone dakrone added :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v8.0.0 v7.13.0 labels Mar 31, 2021
@elasticmachine elasticmachine added the Team:Distributed Meta label for distributed team (obsolete) label Mar 31, 2021
@elasticmachine
Copy link
Collaborator

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

@dakrone
Copy link
Member Author

dakrone commented Mar 31, 2021

@elasticmachine update branch

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

I would like to strengthen it to require _tier_preference=data_frozen for frozen indices (aka partial searchable snapshots).

String[] split = value.split(",");
if (Arrays.stream(split).anyMatch(DATA_FROZEN::equals)) {
throw new IllegalArgumentException("[" + DATA_FROZEN + "] tier can only be used for partial searchable snapshots");
if (Strings.hasText(value)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need to either make _tier_preference validate that partial searchable snapshots always have the value data_frozen (i.e., must be set) or else make that the default when unset.

Ideally, we should remove support for include/exclude/require now that we have the chance too? Can be a separate PR if that is easier.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, we should remove support for include/exclude/require now that we have the chance too? Can be a separate PR if that is easier.

Are you talking about include/exclude/require for _tier, or all include/exclude/require parameters? If you mean only for tier, I think I'd prefer to work out how we want to treat them for regular indices first (since we talked about removing _tier in favor of _tier_preference for all indices) before special casing them for only frozen indices

Copy link
Contributor

Choose a reason for hiding this comment

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

I was only referring to include/exclude/require for _tier. We can tackle it outside this PR. But it feels odd that the only legal exclude value is data_frozen for frozen indices, since that is the last thing you want. When you modify _tier_preference validation to require data_frozen, the validation have to be different for include/exclude/require vs _tier_preference anyway, which is why I was suggesting to tackle this now. But perfectly fine to tackle later too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we need to either make _tier_preference validate that partial searchable snapshots always have the value data_frozen (i.e., must be set) or else make that the default when unset.

I pushed 9bab290 for this

Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if there is still a loophole of setting _tier_preference to either "" (empty) or " " (white-space), since then the default value will not apply and we end up with a frozen shard with no _tier_preference? I think we need to just check for null here to fix that, at least for frozen.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I changed this to be a null comparison

Copy link
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

LGTM.

@dakrone dakrone merged commit b8b9ea0 into elastic:master Apr 6, 2021
@dakrone dakrone deleted the enforce-only-frozen-for-frozen branch April 6, 2021 13:37
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Apr 6, 2021
…lastic#71155)

We already set `data_frozen` for partial searchable snapshots when they are mounted (elastic#70786), and
automatically convert values other than the frozen role automatically for these snapshots when the
metadata is loaded (elastic#71014). This commit makes the `_tier_preference` setting validate that the
setting is *only* `data_frozen` when set on a partial searchable snapshot index.
dakrone added a commit that referenced this pull request Apr 13, 2021
…rence (#71155) (#71342)

* Enforce data_frozen for partial searchable snapshot _tier_preference (#71155)

We already set `data_frozen` for partial searchable snapshots when they are mounted (#70786), and
automatically convert values other than the frozen role automatically for these snapshots when the
metadata is loaded (#71014). This commit makes the `_tier_preference` setting validate that the
setting is *only* `data_frozen` when set on a partial searchable snapshot index.

* Handle mixed version clusters with pre-7.13.0 frozen SBIs

* Fix checkstyyyyyyyyle

* Pass index version in settings for test

* Unconditionally return only data_frozen for setting

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs >enhancement Team:Distributed Meta label for distributed team (obsolete) v7.13.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants