-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Route documents to the correct shards in tsdb #77731
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
Merged
elasticsearchmachine
merged 43 commits into
elastic:master
from
nik9000:index_routing_from_source
Oct 15, 2021
Merged
Changes from 5 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
76f50c3
Route documents to the correct shards in tsdb
nik9000 a6cbecf
Merge branch 'master' into index_routing_from_source
nik9000 8949f79
Merge branch 'master' into index_routing_from_source
nik9000 8480c0b
Merge branch 'master' into index_routing_from_source
nik9000 9828ea0
Moar skip
nik9000 653c7f0
tsdb survives full cluster restart
nik9000 d762a03
Remove auto generated id rejection
nik9000 85faa61
Simplify
nik9000 1b398e5
Forbid routing_required
nik9000 8c00e18
Merge branch 'master' into index_routing_from_source
nik9000 5f65cf2
Merge branch 'master' into index_routing_from_source
nik9000 317cbe6
Small
nik9000 80548de
Fork fork knife
nik9000 517b2cf
Let failures flow
nik9000 b0c6de4
Merge branch 'master' into index_routing_from_source
nik9000 09cb170
Fix full cluster
nik9000 51bcc4d
Merge branch 'master' into index_routing_from_source
nik9000 a3c592a
Always fork
nik9000 b3eae86
Retry?
nik9000 7147bb7
Remove pressure test arm
nik9000 4acf433
Merge branch 'master' into index_routing_from_source
nik9000 e86650f
Add missing settings
nik9000 f021e72
WIP
nik9000 92f10a0
Merge branch 'master' into index_routing_from_source
nik9000 0761120
Remove leftover
nik9000 d501811
More cleaning
nik9000 07b2435
Fixup more tests
nik9000 7d81f2a
Remove old skip
nik9000 99bbf13
New tests for Retry
nik9000 671c83f
More tests
nik9000 0f86b77
Revert unrelated
nik9000 81f1878
Merge branch 'master' into index_routing_from_source
nik9000 d6b644d
Merge branch 'master' into index_routing_from_source
nik9000 b838554
One dispatch please
nik9000 b341a64
Stuff moved
nik9000 5c147d4
More moving
nik9000 75392e2
Explain why fork
nik9000 6ff5158
Back to ActionRunnable
nik9000 076afa5
Update comment
nik9000 db1f179
Utility method
nik9000 90afc69
Move routing_path under feature flag
nik9000 63fa3bd
Imports
nik9000 a4c00f1
Merge branch 'master' into index_routing_from_source
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 hidden or 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
107 changes: 107 additions & 0 deletions
107
...tinode/src/test/resources/rest-api-spec/test/smoke_test_multinode/20_tsdb_consistency.yml
This file contains hidden or 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,107 @@ | ||
# Test the mode:time_series properly groups by _tsid. If we could put this in | ||
# rest-api-spec we would, but it requires painless. | ||
|
||
nik9000 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
setup: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
routing_path: [metricset, k8s.pod.uid] | ||
number_of_shards: 10 | ||
number_of_replicas: 1 | ||
mappings: | ||
properties: | ||
"@timestamp": | ||
type: date | ||
metricset: | ||
type: keyword | ||
dimension: true | ||
k8s: | ||
properties: | ||
pod: | ||
properties: | ||
uid: | ||
type: keyword | ||
dimension: true | ||
name: | ||
type: keyword | ||
ip: | ||
type: ip | ||
network: | ||
properties: | ||
tx: | ||
type: long | ||
rx: | ||
type: long | ||
- do: | ||
bulk: | ||
refresh: true | ||
index: test | ||
body: | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:24.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-28T19:50:04.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-28T17:53:34.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:03:24.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:35:24.467Z", "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-28T19:50:04.467Z", "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-28T17:53:34.467Z", "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:03:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}' | ||
|
||
--- | ||
"index with replicas and shards is green": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
cluster.health: | ||
wait_for_status: green | ||
- match: { status: green } | ||
|
||
--- | ||
"each shard has unique _tsids": | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
size: 0 | ||
aggs: | ||
check: | ||
scripted_metric: | ||
init_script: "state.timeSeries = new HashSet()" | ||
map_script: "state.timeSeries.add(doc['metricset'].value + ':' + doc['k8s.pod.uid'].value)" | ||
combine_script: "return state.timeSeries" | ||
reduce_script: | | ||
Set timeSeries = new TreeSet(); | ||
for (s in states) { | ||
for (ts in s) { | ||
boolean newTs = timeSeries.add(ts); | ||
if (false == newTs) { | ||
throw new IllegalArgumentException(ts + " appeared in two shards"); | ||
} | ||
} | ||
} | ||
return timeSeries; | ||
- match: {hits.total.value: 8} | ||
- match: {aggregations.check.value: ['pod:947e4ced-1786-4e53-9e0c-5c447e959507', 'pod:df3145b3-0563-4d3b-a0f7-897eb2876ea9']} | ||
|
||
# todo clone and shrink |
This file contains hidden or 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
239 changes: 239 additions & 0 deletions
239
...api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/20_unsupported_operations.yml
This file contains hidden or 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,239 @@ | ||
setup: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
index: | ||
mode: time_series | ||
routing_path: [metricset, k8s.pod.uid] | ||
number_of_replicas: 0 | ||
number_of_shards: 2 | ||
mappings: | ||
properties: | ||
"@timestamp": | ||
type: date | ||
metricset: | ||
type: keyword | ||
dimension: true | ||
k8s: | ||
properties: | ||
pod: | ||
properties: | ||
uid: | ||
type: keyword | ||
dimension: true | ||
name: | ||
type: keyword | ||
ip: | ||
type: ip | ||
network: | ||
properties: | ||
tx: | ||
type: long | ||
rx: | ||
type: long | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
index: test | ||
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 with specified id: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
catch: /indexing with a specified id is not supported because the destination index \[test\] is in time series mode/ | ||
index: | ||
index: test | ||
id: foo | ||
body: | ||
doc: | ||
"@timestamp": "2021-04-28T18:35:24.467Z" | ||
metricset: "pod" | ||
k8s: | ||
pod: | ||
name: "cat" | ||
uid: "947e4ced-1786-4e53-9e0c-5c447e959507" | ||
ip: "10.10.55.1" | ||
network: | ||
tx: 2001818691 | ||
rx: 802133794 | ||
|
||
--- | ||
index with specified id over _bulk: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
index: test | ||
body: | ||
- '{"index": {"_id": "foo"}}' | ||
- '{"@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}}}}' | ||
- match: {items.0.index.error.reason: "indexing with a specified id is not supported because the destination index [test] is in time series mode"} | ||
|
||
--- | ||
index with specified routing: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
catch: /indexing with a specified routing is not supported because the destination index \[test\] is in time series mode/ | ||
index: | ||
index: test | ||
routing: foo | ||
body: | ||
doc: | ||
"@timestamp": "2021-04-28T18:35:24.467Z" | ||
metricset: "pod" | ||
k8s: | ||
pod: | ||
name: "cat" | ||
uid: "947e4ced-1786-4e53-9e0c-5c447e959507" | ||
ip: "10.10.55.1" | ||
network: | ||
tx: 2001818691 | ||
rx: 802133794 | ||
|
||
--- | ||
index with specified routing over _bulk: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
index: test | ||
body: | ||
- '{"index": {"routing": "foo"}}' | ||
- '{"@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}}}}' | ||
- match: {items.0.index.error.reason: "indexing with a specified routing is not supported because the destination index [test] is in time series mode"} | ||
|
||
--- | ||
delete: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
catch: /delete is not supported because the destination index \[test\] is in time series mode/ | ||
delete: | ||
index: test | ||
id: 1 | ||
|
||
--- | ||
delete over _bulk: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
bulk: | ||
index: test | ||
body: | ||
- '{"delete": {"_id": 1}}' | ||
- '{"delete": {"_id": 2}}' | ||
- match: {items.0.delete.error.reason: "delete is not supported because the destination index [test] is in time series mode"} | ||
|
||
--- | ||
noop update: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
search: | ||
index: test | ||
size: 1 | ||
|
||
- length: {hits.hits: 1} | ||
|
||
- do: | ||
catch: /update is not supported because the destination index \[test\] is in time series mode/ | ||
update: | ||
index: test | ||
id: $body.hits.hits.0._id | ||
body: | ||
doc: | ||
$body.hits.hits.0._source | ||
|
||
--- | ||
update: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
# We fail even though the document isn't found. | ||
- do: | ||
catch: /update is not supported because the destination index \[test\] is in time series mode/ | ||
update: | ||
index: test | ||
id: 1 | ||
body: | ||
doc: | ||
"@timestamp": "2021-04-28T18:35:24.467Z" | ||
metricset: "pod" | ||
k8s: | ||
pod: | ||
name: "cat" | ||
uid: "947e4ced-1786-4e53-9e0c-5c447e959507" | ||
ip: "10.10.55.1" | ||
network: | ||
tx: 2001818691 | ||
rx: 802133794 | ||
|
||
--- | ||
update over _bulk: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
- do: | ||
bulk: | ||
index: test | ||
body: | ||
- '{"update": {"_id": 1}}' | ||
- '{"doc":{"@timestamp": "2021-04-28T18:03:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}}' | ||
- match: {items.0.update.error.reason: "update is not supported because the destination index [test] is in time series mode"} | ||
|
||
--- | ||
search with routing: | ||
- skip: | ||
version: " - 7.99.99" | ||
reason: introduced in 8.0.0 to be backported to 7.16.0 | ||
|
||
# We fail even though the document isn't found. | ||
- do: | ||
catch: /searching with a specified routing is not supported because the destination index \[test\] is in time series mode/ | ||
search: | ||
index: test | ||
routing: rrrr |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.