Skip to content

[BUG] Request _snapshot/repo/snapshot/_status returns wrong status #7952

@uzhinskiy

Description

@uzhinskiy

Describe the bug
The /_snapshot/repo/snapshot/_status returns snapshot.state=SUCCESS for snapshots that have failed shards and are actually in PARTIAL status.

To reproduce

  1. Make sure you have failed snapshots:
    curl https://endpoint:9200/_cat/snapshots/repo/
snap-2023.06.06 SUCCESS 1686109923 03:52:03 1686112172 04:29:32 37.4m 1 15 0 15
snap-2023.06.07 PARTIAL 1686117675 06:01:15 1686119799 06:36:39 35.4m 1 28 1 29
  1. Get common info of the failed snapshot:
    curl -ks https://endpoint:9200/_snapshot/repo/snap-2023.06.07/?pretty
     {
       "snapshot" : "snap-2023.06.07",
       "version" : "2.4.1",
       "indices" : [
         "index-2023.06.06"
       ],
       "include_global_state" : true,
       "state" : "PARTIAL",  - - - !!! true !!!
       "failure" : [
         {
           "index" : "index-2023.06.06",
           "shard_id" : 1,
           "reason" : "node shutdown",
           "node_id" : "123",
           "status" : "INTERNAL_SERVER_ERROR"
         }
       ],
       "shards" : {
         "total" : 29
         "failed" : 1,
         "successful" : 28
       }
     }
  1. Request the status of this snapshot:
    curl -ks https://endpoint:9200/_snapshot/repo/snap-2023.06.07/_status?pretty
   "snapshots" : [
     {
       "snapshot" : "snap-2023.06.07",
       "repository" : "repo",
       "state" : "SUCCESS", - - - !!! false !!!
       "include_global_state" : true,
       "shards_stats" : {
         "initializing" : 0,
         "started" : 0,
         "finalizing" : 0,
         "done" : 28,
         "failed" : 1,
         "total" : 29
       },
       "indices" : {
         "index-2023.06.06" : {
           "shards_stats" : {
             "initializing" : 0,
             "started" : 0,
             "finalizing" : 0,
             "done" : 28,
             "failed" : 1,
             "total" : 29
           },
           "shards" : {
             ...
             "1" : {
               "stage" : "FAILURE",
               "stat" : {
                 "incremental" : {
                   "file_count" : 0,
                   "size_in_bytes" : 0
                 },
                 "total" : {
                   "file_count" : 0,
                   "size_in_bytes" : 0
                 },
                 "start_time_in_millis" : 0,
                 "time_in_millis" : 0
               },
               "reason" : "node shutdown"
             }
           }
         }
       }
     }
   ]

Expected behavior
The request must return the current snapshot status

Host/Environment (please complete the following information):
OS: Amazon Linux 2

  • Version Opensearch 2.4.1

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions