-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
TSDB: snapshot/restore test #78022
Merged
Merged
TSDB: snapshot/restore test #78022
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
50aec7e
TSDB: snapshot/restore test
nik9000 baf90f7
Merge branch 'master' into tsdb_snapshot_test
nik9000 85e26fd
Fix name
nik9000 38e1db4
Merge branch 'master' into tsdb_snapshot_test
nik9000 62a70a6
Move it
nik9000 7c40b01
Merge branch 'master' into tsdb_snapshot_test
nik9000 59df80a
Revert unneeded
nik9000 6980c3f
Fix range
nik9000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
147 changes: 147 additions & 0 deletions
147
plugins/repository-hdfs/src/test/resources/rest-api-spec/test/hdfs_repository/50_tsdb.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
--- | ||
"Create a snapshot and then restore it": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
features: ["allowed_warnings"] | ||
|
||
# Create repository | ||
- do: | ||
snapshot.create_repository: | ||
repository: test_restore_repository | ||
body: | ||
type: hdfs | ||
settings: | ||
uri: "hdfs://localhost:9999" | ||
path: "test/restore" | ||
|
||
# Create index | ||
- do: | ||
indices.create: | ||
index: test_index | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
number_of_replicas: 0 | ||
number_of_shards: 2 | ||
mappings: | ||
properties: | ||
"@timestamp": | ||
type: date | ||
metricset: | ||
type: keyword | ||
time_series_dimension: true | ||
k8s: | ||
properties: | ||
pod: | ||
properties: | ||
uid: | ||
type: keyword | ||
time_series_dimension: true | ||
name: | ||
type: keyword | ||
ip: | ||
type: ip | ||
network: | ||
properties: | ||
tx: | ||
type: long | ||
rx: | ||
type: long | ||
- do: | ||
bulk: | ||
refresh: true | ||
index: test_index | ||
body: | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2005177954, "rx": 801479970}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:44.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2006223737, "rx": 802337279}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:51:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.2", "network": {"tx": 2012916202, "rx": 803685721}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434521831, "rx": 530575198}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434577921, "rx": 530600088}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434587694, "rx": 530604797}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434521831, "rx": 530575198}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434577921, "rx": 530600088}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434587694, "rx": 530604797}}}}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434595272, "rx": 530605511}}}}' | ||
|
||
|
||
# Wait for green | ||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
|
||
# Take snapshot | ||
- do: | ||
snapshot.create: | ||
repository: test_restore_repository | ||
snapshot: test_restore_tsdb | ||
wait_for_completion: true | ||
|
||
- match: { snapshot.snapshot: test_restore_tsdb } | ||
- match: { snapshot.state : SUCCESS } | ||
- match: { snapshot.shards.successful: 2 } | ||
- match: { snapshot.shards.failed : 0 } | ||
- is_true: snapshot.version | ||
- gt: { snapshot.version_id: 0} | ||
|
||
# Close index | ||
- do: | ||
indices.close: | ||
index : test_index | ||
allowed_warnings: | ||
- "the default value for the ?wait_for_active_shards parameter will change from '0' to 'index-setting' in version 8; specify '?wait_for_active_shards=index-setting' to adopt the future default behaviour, or '?wait_for_active_shards=0' to preserve today's behaviour" | ||
|
||
# Restore index | ||
- do: | ||
snapshot.restore: | ||
repository: test_restore_repository | ||
snapshot: test_restore_tsdb | ||
wait_for_completion: true | ||
|
||
# Check recovery stats | ||
- do: | ||
indices.recovery: | ||
index: test_index | ||
|
||
- match: { test_index.shards.0.type: SNAPSHOT } | ||
- match: { test_index.shards.0.stage: DONE } | ||
- match: { test_index.shards.0.index.files.recovered: 1} | ||
- gt: { test_index.shards.0.index.size.recovered_in_bytes: 0} | ||
|
||
# Remove our snapshot | ||
- do: | ||
snapshot.delete: | ||
repository: test_restore_repository | ||
snapshot: test_restore_tsdb | ||
|
||
# Remove our repository | ||
- do: | ||
snapshot.delete_repository: | ||
repository: test_restore_repository | ||
|
||
- do: | ||
search: | ||
index: test_index | ||
body: | ||
query: | ||
query_string: | ||
query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' | ||
|
||
- match: {hits.total.value: 1} | ||
- match: {hits.hits.0._source.k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507} | ||
# TODO assert that the _tsid is correct after restore. | ||
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. I'd love to use the same trick I use in #78028 to run an agg on |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is this still necessary?