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

Convert ILM and SLM histories into hidden indices #51456

Merged
merged 16 commits into from
Feb 11, 2020

Conversation

gwbrown
Copy link
Contributor

@gwbrown gwbrown commented Jan 24, 2020

Modifies SLM's and ILM's history indices to be hidden indices for added
protection against accidental querying and deletion, and improves
IndexTemplateRegistry to handle upgrading index templates.

Also modifies the REST test cleanup to delete hidden indices.

Modifies SLM's and ILM's history indices to be hidden indices for added
protection against accidental querying and deletion.

Also modifies the REST test cleanup to delete hidden indices.
@gwbrown gwbrown added >enhancement :Data Management/ILM+SLM Index and Snapshot lifecycle management v8.0.0 v7.7.0 labels Jan 24, 2020
@gwbrown gwbrown requested a review from dakrone January 24, 2020 23:40
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (:Core/Features/ILM+SLM)

@gwbrown
Copy link
Contributor Author

gwbrown commented Feb 4, 2020

@dimitris-athanasiou You asked a few days ago whether IndexTemplateRegistry handles template upgrades - I've put up a draft of functionality to do so in 2583880. It still needs tests and whatnot but could you take a look and see if this will suit your needs?

@gwbrown
Copy link
Contributor Author

gwbrown commented Feb 5, 2020

Opened:
#51896
#51900
for the failures.

@dimitris-athanasiou
Copy link
Contributor

Adding template upgrading in IndexTemplateRegistry is just what we need to get #51765 ready to merge. Thanks for doing this one!

@gwbrown gwbrown marked this pull request as ready for review February 5, 2020 22:57
@gwbrown
Copy link
Contributor Author

gwbrown commented Feb 5, 2020

BWC tests aren't enabled right now, and they were failing earlier due to some issues cleaning up hidden indices - I've got a local run going, but I'm not going to merge this until I get a green BWC run from CI. This is otherwise ready for review, @dakrone & @andreidan

I originally mentioned an upgrade test - I haven't written one yet, but covered that functionality in unit tests. Do you think there's a need for additional tests here?

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Gordon! I left a question about some ordering, but it shouldn't be anything major.

@@ -59,9 +59,10 @@ public static void loadTemplateIntoMap(String resource, Map<String, IndexTemplat
public static String loadTemplate(String resource, String version, String versionProperty) {
try {
BytesReference source = load(resource);
validate(source);
final String filteredJson = filter(source, version, versionProperty);
validate(new BytesArray(filteredJson));
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious about this change, why the change to validation post-filter? Was it causing an issue?

Copy link
Contributor Author

@gwbrown gwbrown Feb 6, 2020

Choose a reason for hiding this comment

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

Yes, bare placeholders (e.g. "version": ${my.variable}) didn't work with the validation before the variable replacement because that's not valid JSON, and version must be a bare integer, not a string. Previously, all variables were strings (e.g. "field": "${my.variable}", note the quotes around the variable).

Besides, it's more important that the JSON is valid after we do the variable replacement, rather than before, isn't it?

Copy link
Member

Choose a reason for hiding this comment

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

The name "filter" makes it seem like the filteredJson is a subset of the original, in which case I would think it makes sense to validate the entire JSON instead of a subset. With your explanation it definitely makes sense (the name is just misleading).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is a misleading name - I would have taken the opportunity to change it, but Dimitris is going to do so in #51765, as part of modifying IndexTemplateRegistry (and associated classes) to allow other variable substitutions in addition to the version.

@gwbrown
Copy link
Contributor Author

gwbrown commented Feb 6, 2020

I'm very curious how these changes are causing some tests in GraphWithSecurityIT to fail, but that does somehow seem to be the case. Digging in.

@gwbrown
Copy link
Contributor Author

gwbrown commented Feb 6, 2020

Oh, for some reason the cleanup in ESRestTestCase is being run as the user graph_explorer, which doesn't have permission to check the node versions. We should probably run the cleanup as superuser regardless of what the tests run as.

@gwbrown
Copy link
Contributor Author

gwbrown commented Feb 7, 2020

I discovered an issue with the dot-index deprecation warnings (fix in #52087) while working on this, and this needs a couple minor updates after that fix goes into master.

@gwbrown
Copy link
Contributor Author

gwbrown commented Feb 10, 2020

Ok, #52087 has been merged and I've updated this PR to work with those changes. I'll merge this as soon as we get a green CI run on the latest changes.

@gwbrown gwbrown merged commit 28d1fe0 into elastic:master Feb 11, 2020
gwbrown added a commit to gwbrown/elasticsearch that referenced this pull request Feb 11, 2020
Modifies SLM's and ILM's history indices to be hidden indices for added
protection against accidental querying and deletion, and improves
IndexTemplateRegistry to handle upgrading index templates.

Also modifies the REST test cleanup to delete hidden indices.
gwbrown added a commit that referenced this pull request Feb 11, 2020
Modifies SLM's and ILM's history indices to be hidden indices for added
protection against accidental querying and deletion, and improves
IndexTemplateRegistry to handle upgrading index templates.

Also modifies the REST test cleanup to delete hidden indices.
dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this pull request Feb 12, 2020
After elastic#51456 `IndexTemplateRegistry` is updating tempaltes and ILM
policies if necessary. However, even if the upgrade succeeds we keep
trying. This commit fixes the issue by setting the `creationCheck`
on success.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants