mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-31 20:38:40 +00:00
REST test for rolling data streams
This commit is contained in:
parent
462c0337a1
commit
9bf254fe36
@ -0,0 +1,44 @@
|
|||||||
|
---
|
||||||
|
"Roll over a data stream":
|
||||||
|
- skip:
|
||||||
|
version: " - 7.99.99"
|
||||||
|
reason: "enable in 7.8+ after backporting"
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.create_data_stream:
|
||||||
|
name: data-stream-for-rollover
|
||||||
|
body:
|
||||||
|
timestamp_field: "@timestamp"
|
||||||
|
- is_true: acknowledged
|
||||||
|
|
||||||
|
# rollover data stream to create new backing index
|
||||||
|
- do:
|
||||||
|
indices.rollover:
|
||||||
|
alias: "data-stream-for-rollover"
|
||||||
|
|
||||||
|
- match: { old_index: data-stream-for-rollover-000001 }
|
||||||
|
- match: { new_index: data-stream-for-rollover-000002 }
|
||||||
|
- match: { rolled_over: true }
|
||||||
|
- match: { dry_run: false }
|
||||||
|
|
||||||
|
# ensure new index is created
|
||||||
|
- do:
|
||||||
|
indices.exists:
|
||||||
|
index: data-stream-for-rollover-000002
|
||||||
|
|
||||||
|
- is_true: ''
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.get_data_streams:
|
||||||
|
name: "*"
|
||||||
|
- match: { 0.name: data-stream-for-rollover }
|
||||||
|
- match: { 0.timestamp_field: '@timestamp' }
|
||||||
|
- match: { 0.generation: 2 }
|
||||||
|
- length: { 0.indices: 2 }
|
||||||
|
- match: { 0.indices.0.index_name: 'data-stream-for-rollover-000001' }
|
||||||
|
- match: { 0.indices.1.index_name: 'data-stream-for-rollover-000002' }
|
||||||
|
|
||||||
|
- do:
|
||||||
|
indices.delete_data_stream:
|
||||||
|
name: data-stream-for-rollover
|
||||||
|
- is_true: acknowledged
|
@ -96,6 +96,7 @@ public final class DataStream extends AbstractDiffable<DataStream> implements To
|
|||||||
public DataStream removeBackingIndex(Index index) {
|
public DataStream removeBackingIndex(Index index) {
|
||||||
List<Index> backingIndices = new ArrayList<>(indices);
|
List<Index> backingIndices = new ArrayList<>(indices);
|
||||||
backingIndices.remove(index);
|
backingIndices.remove(index);
|
||||||
|
assert backingIndices.size() == indices.size() - 1;
|
||||||
return new DataStream(name, timeStampField, backingIndices, generation);
|
return new DataStream(name, timeStampField, backingIndices, generation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user