OpenSearch icon indicating copy to clipboard operation
OpenSearch copied to clipboard

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

Open hogesako opened this issue 1 year ago • 2 comments

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 https://github.com/opensearch-project/opensearch-api-specification/pull/611#discussion_r1797726755

hogesako avatar Oct 15 '24 12:10 hogesako

@andrross @harishbhakuni @kalsak @gbbafna

dblock avatar Oct 16 '24 10:10 dblock

[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 .

gbbafna avatar Oct 17 '24 15:10 gbbafna

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

Aradhya2708 avatar Nov 01 '24 11:11 Aradhya2708