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

[BUG] The /{index}/_recovery API returns responses in a non-standard format(using camelCase). #16334

Open
hogesako opened this issue Oct 15, 2024 · 3 comments · May be fixed by #16541
Open

[BUG] The /{index}/_recovery API returns responses in a non-standard format(using camelCase). #16334

hogesako opened this issue Oct 15, 2024 · 3 comments · May be fixed by #16541
Labels
bug Something isn't working good first issue Good for newcomers Other Storage:Snapshots

Comments

@hogesako
Copy link
Contributor

Describe the bug

The /{index}/_recovery API returns the following response.
The field names isSearchableSnapshot, remoteStoreIndexShallowCopy, sourceRemoteStoreRepository and sourceRemoteTranslogRepository are in non-standard format(using camelCase).

{
  "test_index": {
    "shards": [
      {
        "id": 0,
        "type": "SNAPSHOT",
        "stage": "DONE",
        "primary": true,
        "start_time_in_millis": 1728835477686,
        "stop_time_in_millis": 1728835477725,
        "total_time_in_millis": 39,
        "source": {
          "repository": "test-repository",
          "snapshot": "6",
          "version": "2.17.0",
          "index": "test_index",
          "restoreUUID": "n7wQKoo_RpiFVXJB5BuKDQ",
          "isSearchableSnapshot": false,
          "remoteStoreIndexShallowCopy": false,
          "sourceRemoteStoreRepository": null,
          "sourceRemoteTranslogRepository": null
        },
        "target": {
          "id": "UtghWlpCT3akPM5wbVJxXA",
          "host": "172.19.0.2",
          "transport_address": "172.19.0.2:9300",
          "ip": "172.19.0.2",
          "name": "jdk21"
        },
        "index": {
          "size": {
            "total_in_bytes": 208,
            "reused_in_bytes": 0,
            "recovered_in_bytes": 208,
            "percent": "100.0%"
          },
          "files": {
            "total": 1,
            "reused": 0,
            "recovered": 1,
            "percent": "100.0%"
          },
          "total_time_in_millis": 23,
          "source_throttle_time_in_millis": 0,
          "target_throttle_time_in_millis": 0
        },
        "translog": {
          "recovered": 0,
          "total": 0,
          "percent": "100.0%",
          "total_on_start": 0,
          "total_time_in_millis": 7
        },
        "verify_index": {
          "check_index_time_in_millis": 0,
          "total_time_in_millis": 0
        }
      }
    ]
  }
}

Source code is also implemented in CamelCase.
https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/cluster/routing/RecoverySource.java#L413-L421

Related component

Other

To Reproduce

  1. Restore snapshot.
  2. Access /{index}/_recovery API.

Expected behavior

API must be returned in standard format.

Additional Details

Plugins
None

Screenshots
None

Host/Environment (please complete the following information):

  • OpenSearch 2.17.0 on docker

Additional context
opensearch-project/opensearch-api-specification#611 (comment)

@dblock
Copy link
Member

dblock commented Oct 16, 2024

@gbbafna
Copy link
Collaborator

gbbafna commented Oct 17, 2024

[Storage Triage] - Attendees 1 2 3 4 5

Thanks for filing this issue . We would welcome any contribution to correct this as per convention in 3.0 . Note that we wouldn't be backport this to 2.x as it would be a non backward compatible change .

Going forward , we should adhere to maintain the standard format in our APIs .

@linuxpi had a suggestion to add a gradle check to determine that we adhere to the standards in our api .

@Aradhya2708
Copy link

Hi team, I’ve submitted a PR that addresses issue #16334 by updating the field names in the /index/_recovery API response to use snake_case, aligning with the API’s naming conventions.

@andrross @harishbhakuni @KALSAK @gbbafna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers Other Storage:Snapshots
Projects
Status: 🆕 New
4 participants