Data stream support for ILM remove policy API (#58595) (#58770)

This commit is contained in:
Dan Hermann 2020-06-30 14:03:19 -05:00 committed by GitHub
parent a84ff81743
commit 22806c943d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 91 additions and 1 deletions

View File

@ -56,7 +56,7 @@ public class TransportRemoveIndexLifecyclePolicyAction extends TransportMasterNo
@Override
protected void masterOperation(Request request, ClusterState state, ActionListener<Response> listener) throws Exception {
final Index[] indices = indexNameExpressionResolver.concreteIndices(state, request.indicesOptions(), request.indices());
final Index[] indices = indexNameExpressionResolver.concreteIndices(state, request.indicesOptions(), true, request.indices());
clusterService.submitStateUpdateTask("remove-lifecycle-for-index",
new AckedClusterStateUpdateTask<Response>(request, listener) {

View File

@ -149,3 +149,93 @@
indices.delete_data_stream:
name: logs-ds-rollup
- is_true: acknowledged
---
"Verify data stream resolvability in ILM remove policy API":
- skip:
version: " - 7.99.99"
reason: "change to 7.8.99 after backport"
features: allowed_warnings
- do:
ilm.put_lifecycle:
policy: "my_moveable_timeseries_lifecycle"
body: |
{
"policy": {
"phases": {
"warm": {
"min_age": "1000s",
"actions": {
"forcemerge": {
"max_num_segments": 10000
}
}
},
"hot": {
"min_age": "1000s",
"actions": { }
}
}
}
}
- do:
allowed_warnings:
- "index template [my-template1] has index patterns [simple-data-stream1] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template1] will take precedence during new index creation"
indices.put_index_template:
name: my-template1
body:
index_patterns: [simple-data-stream1]
template:
mappings:
properties:
'@timestamp':
type: date
settings:
index.lifecycle.name: "my_moveable_timeseries_lifecycle"
data_stream:
timestamp_field: '@timestamp'
- do:
indices.create_data_stream:
name: simple-data-stream1
- is_true: acknowledged
# rollover data stream to create new backing index
- do:
indices.rollover:
alias: "simple-data-stream1"
- match: { old_index: .ds-simple-data-stream1-000001 }
- match: { new_index: .ds-simple-data-stream1-000002 }
- match: { rolled_over: true }
- match: { dry_run: false }
# verify policy applied to all backing indices
- do:
indices.get_settings:
index: ".ds-simple-data-stream1-*"
- match: { \.ds-simple-data-stream1-000001.settings.index.lifecycle.name: my_moveable_timeseries_lifecycle }
- match: { \.ds-simple-data-stream1-000002.settings.index.lifecycle.name: my_moveable_timeseries_lifecycle }
- do:
ilm.remove_policy:
index: "simple-data-stream1"
- is_false: has_failures
- length: { failed_indexes: 0 }
# verify policy removed from all backing indices
- do:
indices.get_settings:
index: ".ds-simple-data-stream1-*"
- is_false: \.ds-simple-data-stream1-000001.settings.index.lifecycle
- is_false: \.ds-simple-data-stream1-000002.settings.index.lifecycle
- do:
indices.delete_data_stream:
name: simple-data-stream1
- is_true: acknowledged