Skip to content

[7.x] Enforce data_frozen for partial searchable snapshot _tier_preference (#71155)#71342

Merged
dakrone merged 7 commits intoelastic:7.xfrom
dakrone:backport/7.x/pr-71155
Apr 13, 2021
Merged

[7.x] Enforce data_frozen for partial searchable snapshot _tier_preference (#71155)#71342
dakrone merged 7 commits intoelastic:7.xfrom
dakrone:backport/7.x/pr-71155

Conversation

@dakrone
Copy link
Copy Markdown
Member

@dakrone dakrone commented Apr 6, 2021

Backports the following commits to 7.x:

…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 dakrone added backport :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs v7.13.0 labels Apr 6, 2021
@elasticmachine elasticmachine added the Team:Distributed Meta label for distributed team. label Apr 6, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

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

@dakrone
Copy link
Copy Markdown
Member Author

dakrone commented Apr 6, 2021

@elasticmachine update branch

Comment on lines +73 to +86
public String get(Settings settings) {
final Version idxVersion = IndexMetadata.SETTING_INDEX_VERSION_CREATED.get(settings);
if (idxVersion.onOrAfter(Version.V_7_13_0)) {
// 7.13.0+ indices can use the original setting value
return super.get(settings);
} else if (SearchableSnapshotsConstants.isPartialSearchableSnapshotIndex(settings)) {
// Partial searchable snapshot indices should be restricted to
// only data_frozen when reading the setting, or else validation fails.
return DATA_FROZEN;
} else {
// Otherwise pass through to the regular setting retrieval
return super.get(settings);
}
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@henningandersen I ended up having to change this for the backport. I'm not sure yet how I feel about it. Otherwise, a shared_cache searchable snapshot index created in 7.12.1 in a mixed-version cluster (where some clusters are 7.13.0) cause validation failures for the index, since we set it to data_frozen,data_cold,data_warm,data_hot in 7.12.1 and reject that in 7.13.0

Does this seem like a reasonable compromise for that case?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dakrone I do not really have a better workaround except to allow an explicit upgrade which does seems a bit excessive. I could be mildly worried about Settings.Builder.put(Settings) copying the underlying map rather than the setting values, meaning a copy would get the full string, but I have a hard time figuring out a scenario where this could cause issues. I would possibly prefer to avoid the version check in 7.x and just always return DATA_FROZEN for frozen indices.

Maybe @rjernst has input to this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the current code in the PR is the right approach. I don't think copying via settings builder will be an issue, whatever is in the map will be the same in the new map, there won't be any translation (we don't call get to copy the values, since we don't have the appropriate Setting objects).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay, thanks for taking a look Ryan.

@henningandersen I pushed a change to make it unconditional instead of version-checked.

@dakrone dakrone requested a review from henningandersen April 6, 2021 22:22
Copy link
Copy Markdown
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 a49341c into elastic:7.x Apr 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed Meta label for distributed team. v7.13.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants