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
API for locating unrecovered shard copies and their state #10952
Comments
I think this would be awesome to have. We already have most of the infrastructure to get this information. We can also make it relatively fast with our new async shard fetching classes |
@areek what information are you able to expose? I'm thinking that maybe we should add a new API like:
|
Hey @clintongormley, The API:
(action name is up for debate) The response will report the following on all copies of unassigned shards for specified indices:
{
"indices": {
"<index>": {
"shards": {
"<shard_id>": [
{
"node": "UcZRcveHSjyfiN0rHalDsQ",
"version": 6,
"exception": {..}
},
{
....
}
],
"<shard_id>": [
....
]
}
}
}
} Thoughts? |
nice. I would call this "_list_stores" or something similar (the unassigned name means shards for which we have no store available or are throttled for being assigned). Question-- what is the exception? I presume it's a corruption marker? If so call it corruption? |
@bleskes thanks for the suggestion. "_list_stores" seem to imply that the API will list all the shard stores for the indices rather than only list stores of the copies of the currently unassigned shards? But I can not think of a better name though :). The exception is thrown when trying to open the shard index, can be caused by corruption marker or if the segment infos file can not be read. Maybe it still makes sense to call it corruption? |
@areek I looked at the implementation and I'm not happy with re: exception vs corruption - I think we should call it corruption and also make In general it fills to mee better to have API list unassigned shards by default but have a parameter to make list everything the nodes have . Should be very simple to implement and will give us an alternative to telling customers to grep their disks. |
well we can also have exceptions if there is no index there for instance which is not a corruption? |
We could expose this as a
Thoughts? |
I hear you see and see the distinction but I think it's OK to call this corruption (index is gone, is it distinguishable from a missing segment_n file?). All I was going at is that we need another name then a generic exception because currrently it's confusing - it's hard to telll if the operation has failed (ES/API exception) or the shard is bad (and I know we are adding a
|
I don't like including
The I think the default should actually be Do we need to filter by node? I was considering whether this should be a |
IMO it makes the purpose of the API clear. Locate all shards and their state meta-data for some index/indices. {
"indices": {
"<index>": {
"shards": {
"<shard_id>": [
{
"node": "UcZRcveHSjyfiN0rHalDsQ",
"version": 6,
"state": UNASSIGNED | STARTED | INITIALIZING | RELOCATING
"exception": {..}
},
{
....
}
],
"<shard_id>": [
....
]
}
}
}
} Thoughts?
We currently filter by
@s1monw currently this is indicated by version being |
lgtm
Nodes and indices are two ways of looking at the same data. eg we have indices stats, and we have nodes-indices stats (which show index stats per node). But agreed that it is a nice to have, most of the time we're interested in viewing this data by index. |
My concern with just shards is that it's not clear we're going to disk and reporting what we found. It has nothing to do with the current state of shards as far as the cluster is concerned (at list as implemented now) - we don't care if shards are relocating, available for search etc. We need a name the reflect this (or change the API to do more in the future). Maybe something like
That said, something simple like
+1 . If we need a node oriented API, we can add that as well later on.
Can we use a DiscoveryNode instead of just an id? id's are hard to resolve and don't mean much on their own (they are random).
These are shard routings values. Things like initializing and relocating are a bit confusing imho. I think a simpler message is whether the store is "used" or not. I would use
I confused here - shard that never existed will not have an entry right? shards where the ShardStateMetaData is corrupted will only have an exception (or corruption ) and shard where ShardStateMetaData is OK but the lucene index is bad will have both. I feel like I miss something... |
Rethinking this API a bit. When would you need it? The typical use case is: I have unassigned primary shards and I want to know if copies of the shard exist somewhere in my cluster and whether they can recover or not. Replicas don't matter because they can recover from the primary. So what I want to see are a list or shards which could become the primary, where they are, and if there has been a problem trying to open the shard already. So perhaps we can drop the assigned shards completely and make this an API for unassigned primaries only. What about:
And we can drop the |
…atuses of their copies in the cluster for shard recovery. This PR adds an API that reports the nodes that hold copies of unassigned shards for specific indices, the shard versions (which indicate how recent the copy is) and any exceptions encountered while trying to open the shard indices. The action backing the API is implemented as a master read operation, reading the list of unassigned shards for specified indicies from the cluster state and then fetching shard metadata from all the nodes in the cluster. closes elastic#10952
During shard recovery, Elasticsearch reaches out to all the nodes to find out which nodes hold copies of the shard. It then chooses one copy and tries to recover it. Recovery may fail (eg if there is corruption).
It would be good to have an API which exposes this information, eg:
The text was updated successfully, but these errors were encountered: