-
Notifications
You must be signed in to change notification settings - Fork 25.2k
remove old doc placeholder and migrate ilm docs to top-level #34615
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
Changes from 3 commits
3a7f1f4
a83a464
5f3541f
a3c851a
d8278fa
798abab
03defff
71ac18b
a6b9af8
3a28734
5bc8f27
870655e
020171c
5fd6da2
4403e3f
c64b5b7
c3538ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[role="xpack"] | ||
[[get-index-lifecycle-information]] | ||
== Get index lifecycle information | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
[role="xpack"] | ||
[[getting-started-index-lifecycle-management]] | ||
== Getting started with {ilm} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[role="xpack"] | ||
[testenv="basic"] | ||
[[set-up-lifecycle-policy]] | ||
== Set up {ilm} policy | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[role="xpack"] | ||
[testenv="basic"] | ||
[[update-lifecycle-policy]] | ||
== Update lifecycle policy | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
[role="xpack"] | ||
[testenv="basic"] | ||
[[using-policies-rollover]] | ||
== Using policies to manage index rollover | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,7 +210,8 @@ protected static RestClient adminClient() { | |
/** | ||
* Returns whether to preserve the state of the cluster upon completion of this test. Defaults to false. If true, overrides the value of | ||
* {@link #preserveIndicesUponCompletion()}, {@link #preserveTemplatesUponCompletion()}, {@link #preserveReposUponCompletion()}, | ||
* {@link #preserveSnapshotsUponCompletion()}, and {@link #preserveRollupJobsUponCompletion()}. | ||
* {@link #preserveSnapshotsUponCompletion()},{@link #preserveRollupJobsUponCompletion()}, | ||
* and {@link #preserveILMPoliciesUponCompletion()}. | ||
* | ||
* @return true if the state of the cluster should be preserved | ||
*/ | ||
|
@@ -275,6 +276,15 @@ protected boolean preserveRollupJobsUponCompletion() { | |
return false; | ||
} | ||
|
||
/** | ||
* Returns whether to preserve ILM Policies of this test. Defaults to not | ||
* preserviing them. Only runs at all if xpack is installed on the cluster | ||
* being tested. | ||
*/ | ||
protected boolean preserveILMPoliciesUponCompletion() { | ||
return false; | ||
} | ||
|
||
private void wipeCluster() throws Exception { | ||
boolean hasXPack = hasXPack(); | ||
|
||
|
@@ -329,6 +339,11 @@ private void wipeCluster() throws Exception { | |
wipeRollupJobs(); | ||
waitForPendingRollupTasks(); | ||
} | ||
|
||
if (hasXPack && false == preserveILMPoliciesUponCompletion()) { | ||
removePoliciesFromAllIndexes(); | ||
deleteAllPolicies(); | ||
} | ||
} | ||
|
||
/** | ||
|
@@ -441,6 +456,46 @@ private void waitForPendingRollupTasks() throws Exception { | |
}); | ||
} | ||
|
||
private static void removePoliciesFromAllIndexes() throws IOException { | ||
Response response = adminClient().performRequest(new Request("GET", "/_all")); | ||
Map<String, Object> indexes = ESRestTestCase.entityAsMap(response); | ||
|
||
if (indexes == null || indexes.isEmpty()) { | ||
return; | ||
} | ||
|
||
for (String indexName : indexes.keySet()) { | ||
try { | ||
adminClient().performRequest(new Request("DELETE", indexName + "/_ilm/")); | ||
} catch (Exception e) { | ||
// ok | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK because we're racing? Maybe we should add the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We're really only ok with 404s here, right? |
||
} | ||
} | ||
} | ||
|
||
private static void deleteAllPolicies() throws Exception { | ||
Map<String, Object> policies; | ||
|
||
try { | ||
Response response = adminClient().performRequest(new Request("GET", "/_ilm")); | ||
policies = ESRestTestCase.entityAsMap(response); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are already in |
||
} catch (Exception e) { | ||
return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems a bit broad. |
||
} | ||
|
||
if (policies == null || policies.isEmpty()) { | ||
return; | ||
} | ||
|
||
for (String policyName : policies.keySet()) { | ||
try { | ||
adminClient().performRequest(new Request("DELETE", "/_ilm/" + policyName)); | ||
} catch (Exception e) { | ||
// ok | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as before about why this is ok. |
||
} | ||
} | ||
} | ||
|
||
/** | ||
* Logs a message if there are still running tasks. The reasoning is that any tasks still running are state the is trying to bleed into | ||
* other tests. | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'll usually have wiped the indices already. Do we need to do this in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, you're right. this is unnecessary