Skip to content
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

cat/indices no longer shows indices currently being restored #39933

Closed
sophiec20 opened this issue Mar 11, 2019 · 5 comments · Fixed by #43286
Closed

cat/indices no longer shows indices currently being restored #39933

sophiec20 opened this issue Mar 11, 2019 · 5 comments · Fixed by #43286
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates v7.3.0

Comments

@sophiec20
Copy link
Contributor

sophiec20 commented Mar 11, 2019

Elasticsearch version (bin/elasticsearch --version):
Version: 8.0.0-SNAPSHOT, Build: default/tar/4957cad/2019-03-11T15:48:39.514013Z, JVM: 1.8.0_151

Plugins installed: []
repository_gcs

JVM version (java -version):

OS version (uname -a if on a Unix-like system):

Description of the problem including expected versus actual behavior:

This is a usability nit.

Restoring a large snapshot may take some time. During this period you can no longer see the restoring indices listed in GET _cat/indices therefore you may think that the restore might not have been initiated.

If you re-run the restore command, you get the error below saying that the index already exists.

This is a change from 6.x where the indices would be listed immediately by GET _cat/indices with their health as yellow. This was a convenient way to see that the restoration was in progress, especially for snapshots with multiple indices.

Perhaps the index list behaviour could be returned to previous, or a more useful error message be displayed to explain that the restore is in progress.

{
  "error": {
    "root_cause": [
      {
        "type": "snapshot_restore_exception",
        "reason": "[my_repo:a_large_snapshot/fYI6EIhEQYm0E_tbDiOEgA] cannot restore index [filebeat-2019] because an open index with same name already exists in the cluster. Either close or delete the existing index or restore the index under a different name by providing a rename pattern and replacement name"
      }
    ],
    "type": "snapshot_restore_exception",
    "reason": "[my_repo:a_large_snapshot/fYI6EIhEQYm0E_tbDiOEgA] cannot restore index [filebeat-2019] because an open index with same name already exists in the cluster. Either close or delete the existing index or restore the index under a different name by providing a rename pattern and replacement name"
  },
  "status": 500
}

Found in 3 node cluster.

Steps to reproduce:

Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.

  1. POST _snapshot/my_repo/a_large_snapshot/_restore -- restore a large snapshot
  2. GET _cat/indices -- notice indices are not yet listed
  3. POST _snapshot/my_repo/a_large_snapshot/_restore -- re-run the restore again, before the first step has had a chance to finish.

Provide logs (if relevant):

@sophiec20 sophiec20 added the :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs label Mar 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@ywelsch
Copy link
Contributor

ywelsch commented Mar 11, 2019

I think the bug here is that a restoring index is no longer appearing in _cat/indices. @albertzaharovits this looks related to #38824, and in particular the following line https://github.com/elastic/elasticsearch/pull/38824/files#diff-bfeab4b634ba416b081c4d23a01b1fc8R413 where indices with missing index stats are removed from the output. If multiple indices are restored from a snapshot, it's possible that for some indices none of the primary shards are assigned (as we throttle the number of simultaneously recovering shards). If none of the shards of an index are assigned, that index will not turn up in the indices stats, and the above change will therefore filter it out.

@ywelsch ywelsch added >bug :Data Management/Indices APIs APIs to create and manage indices and templates v7.2.0 labels Mar 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@ywelsch ywelsch removed the :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs label Mar 11, 2019
@albertzaharovits
Copy link
Contributor

@ywelsch I think you're right. The change introducing this bug hides indices for which the indices stats API returns empty. From what I understand, indices in the process of being restored also don't appear in the indices stats response.

The simple fix, i.e. to include such indices from the cluster state, will expose names that the user is not authorized to see.
I will mull over it, but my guts feeling for a solution would be to expose these in some API (not reading them from cluster state). Would it make sense to expose them in the indices stats output? I realize this is not exactly the scope of the indices stats API, but given the similarity of the outputs between indices stats and _cat/indices failing to show them in the former compared to the latter might be seen like a bug as well.

@ywelsch
Copy link
Contributor

ywelsch commented Mar 12, 2019

given the similarity of the outputs between indices stats and _cat/indices failing to show them in the former compared to the latter might be seen like a bug as well

I agree that that is confusing. If we want to address that, then it becomes a much larger discussion though.

I wonder if we can instead use a GetIndexRequest instead of a ClusterStateRequest to get the list of indices to consider for the output

@jakelandis jakelandis added v7.3.0 and removed v7.2.0 labels Jun 17, 2019
tlrx added a commit that referenced this issue Jun 25, 2019
After two recent changes (#38824 and #33888), the _cat/indices API
no longer report information for active recovering indices and 
non-replicated closed indices. It also misreport replicated closed 
indices that are potentially not authorized for the user.

This commit changes how the cat action works by first using the 
Get Settings API in order to resolve authorized indices. It then uses 
the Cluster State, Cluster Health and Indices Stats APIs to retrieve
 information about the indices.

Closes #39933
tlrx added a commit to tlrx/elasticsearch that referenced this issue Jun 25, 2019
After two recent changes (elastic#38824 and elastic#33888), the _cat/indices API
no longer report information for active recovering indices and
non-replicated closed indices. It also misreport replicated closed
indices that are potentially not authorized for the user.

This commit changes how the cat action works by first using the
Get Settings API in order to resolve authorized indices. It then uses
the Cluster State, Cluster Health and Indices Stats APIs to retrieve
 information about the indices.

Closes elastic#39933
tlrx added a commit that referenced this issue Jun 25, 2019
After two recent changes (#38824 and #33888), the _cat/indices API
no longer report information for active recovering indices and
non-replicated closed indices. It also misreport replicated closed
indices that are potentially not authorized for the user.

This commit changes how the cat action works by first using the
Get Settings API in order to resolve authorized indices. It then uses
the Cluster State, Cluster Health and Indices Stats APIs to retrieve
 information about the indices.

Closes #39933
tlrx added a commit to tlrx/elasticsearch that referenced this issue Jun 26, 2019
After two recent changes (elastic#38824 and elastic#33888), the _cat/indices API
no longer report information for active recovering indices and
non-replicated closed indices. It also misreport replicated closed
indices that are potentially not authorized for the user.

This commit changes how the cat action works by first using the
Get Settings API in order to resolve authorized indices. It then uses
the Cluster State, Cluster Health and Indices Stats APIs to retrieve
information about the indices.

Closes elastic#39933
tlrx added a commit that referenced this issue Jun 26, 2019
After two recent changes (#38824 and #33888), the _cat/indices API
no longer report information for active recovering indices and
non-replicated closed indices. It also misreport replicated closed
indices that are potentially not authorized for the user.

This commit changes how the cat action works by first using the
Get Settings API in order to resolve authorized indices. It then uses
the Cluster State, Cluster Health and Indices Stats APIs to retrieve
information about the indices.

Closes #39933
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/Indices APIs APIs to create and manage indices and templates v7.3.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants