Skip to content

[BUG] Snapshot % complete calculate is incorrect #1687

@sudosaket

Description

@sudosaket

What is the bug?

When we use the migration assistant to take create a snapshot via console snapshot create, the percent completed stat from the status command are incorrectly computed under the following circumstances:

  • a previous snapshot already exists (eg. ma-snapshot-1)
  • the snapshot that is being created is an incremental one (eg. ma-snapshot-2)

What are your migration environments?

Opensearch 2.17

How can one reproduce the bug?

  • create a snapshot using the migration assistant
  • update the snapshot config to change the snapshot name (so that we can take another incremental snapshot)
  • create a snapshot using the migration assistant a second time
  • check the progress using console snapshot status --deep-check
  • the output should be as follows (which is incorrect)
SUCCESS
Snapshot is SUCCESS.
Percent completed: 16.40%
Data GiB done: 56.060/341.817
Total shards: 747
Successful shards: 747
Failed shards: 0
Start time: 2025-07-23 15:07:44
Duration: 0h 2m 58s
Anticipated duration remaining: 0h 15m 12s
Throughput: 320.84 MiB/sec

What is the expected behavior?

The expected behavior should be that the % completion should be 100% as evident from the opensearch APIs:

GET _snapshot/migration_assistant_repo/ma-snapshot-2/_status

# excluding unnecessary fields

{
  "snapshots": [
    {
      "state": "SUCCESS",
      "include_global_state": true,
      "shards_stats": {
        "initializing": 0,
        "started": 0,
        "finalizing": 0,
        "done": 747,
        "failed": 0,
        "aborted": 0,
        "total": 747
      },
      "stats": {
        "incremental": {
          "file_count": 3896,
          "size_in_bytes": 60194325053
        },
        "total": {
          "file_count": 36365,
          "size_in_bytes": 367023410293
        },
        "start_time_in_millis": 1753283264535,
        "time_in_millis": 178921
      }
    }
  ]
}

Do you have any additional context?

We should compute the progress from the incremental stats if present.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions