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

Fix snapshot status numeric property types #729

Merged
merged 4 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixed response code in `PUT /_plugins/_rollup/jobs/{id}` ([#716](https://github.com/opensearch-project/opensearch-api-specification/pull/716))
- Fixed response schema for `/_render/template` and `/_render/template/{id}` ([#724](https://github.com/opensearch-project/opensearch-api-specification/pull/724))
- Fixed data stream schema numeric property types ([#725](https://github.com/opensearch-project/opensearch-api-specification/pull/725))
- Fixed snapshot status numeric property types ([#729](https://github.com/opensearch-project/opensearch-api-specification/pull/729))

### Changed
- Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683))
Expand Down
68 changes: 43 additions & 25 deletions spec/schemas/snapshot._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,13 @@ components:
chunk_size:
type: string
compress:
oneOf:
- type: string
- type: boolean
$ref: '_common.yaml#/components/schemas/StringifiedBoolean'
concurrent_streams:
oneOf:
- type: string
- type: number
$ref: '_common.yaml#/components/schemas/StringifiedInteger'
location:
type: string
read_only:
oneOf:
- type: string
- type: boolean
$ref: '_common.yaml#/components/schemas/StringifiedBoolean'
required:
- location
Status:
Expand All @@ -132,7 +126,6 @@ components:
uuid:
$ref: '_common.yaml#/components/schemas/Uuid'
required:
- include_global_state
- indices
- repository
- shards_stats
Expand All @@ -158,6 +151,10 @@ components:
SnapshotShardsStatus:
type: object
properties:
node:
$ref: '_common.yaml#/components/schemas/NodeId'
reason:
type: string
stage:
$ref: '#/components/schemas/ShardsStatsStage'
stats:
Expand All @@ -166,18 +163,29 @@ components:
- stage
- stats
ShardsStatsStage:
type: string
enum:
- DONE
- FAILURE
- FINALIZE
- INIT
- STARTED
oneOf:
- type: string
const: DONE
description: Number of shards in the snapshot that were successfully stored in the repository.
- type: string
const: FAILURE
description: Number of shards in the snapshot that were not successfully stored in the repository.
- type: string
const: FINALIZE
description: Number of shards in the snapshot that are in the finalizing stage of being stored in the repository.
- type: string
const: INIT
description: Number of shards in the snapshot that are in the initializing stage of being stored in the repository.
- type: string
const: STARTED
description: Number of shards in the snapshot that are in the started stage of being stored in the repository.
ShardsStatsSummary:
type: object
properties:
incremental:
$ref: '#/components/schemas/ShardsStatsSummaryItem'
processed:
$ref: '#/components/schemas/ShardsStatsSummaryItem'
total:
$ref: '#/components/schemas/ShardsStatsSummaryItem'
start_time_in_millis:
Expand All @@ -195,7 +203,8 @@ components:
type: object
properties:
file_count:
type: number
type: integer
format: int64
size_in_bytes:
$ref: '_common.yaml#/components/schemas/ByteCount'
required:
Expand All @@ -205,17 +214,23 @@ components:
type: object
properties:
done:
type: number
type: integer
format: int64
failed:
type: number
type: integer
format: int64
finalizing:
type: number
type: integer
format: int64
initializing:
type: number
type: integer
format: int64
started:
type: number
type: integer
format: int64
total:
type: number
type: integer
format: int64
required:
- done
- failed
Expand All @@ -228,6 +243,8 @@ components:
properties:
incremental:
$ref: '#/components/schemas/FileCountSnapshotStats'
processed:
$ref: '#/components/schemas/FileCountSnapshotStats'
start_time_in_millis:
$ref: '_common.yaml#/components/schemas/EpochTimeUnitMillis'
time:
Expand All @@ -245,7 +262,8 @@ components:
type: object
properties:
file_count:
type: number
type: integer
format: int32
size_in_bytes:
$ref: '_common.yaml#/components/schemas/ByteCount'
required:
Expand Down
66 changes: 66 additions & 0 deletions tests/snapshot/snapshot/status.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test _snapshot/{repository}/snapshot endpoints.
epilogues:
- path: /_snapshot/{repository}/{snapshot}
method: DELETE
status: [200, 404]
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
- path: /_snapshot/{repository}
method: DELETE
status: [200, 404]
parameters:
repository: my-fs-repository
prologues:
- path: /_snapshot/{repository}
method: PUT
parameters:
repository: my-fs-repository
request:
payload:
type: fs
settings:
location: /tmp/opensearch/repo
- path: /_snapshot/{repository}/{snapshot}
method: PUT
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
request:
payload:
indices: '*'
ignore_unavailable: true
include_global_state: false
partial: true
chapters:
- synopsis: Get status of all running snapshots.
path: /_snapshot/_status
method: GET
response:
status: 200
payload:
snapshots:
- snapshot: my-test-snapshot
- synopsis: Get status of all running snapshots in specific repository.
path: /_snapshot/{repository}/_status
method: GET
parameters:
repository: my-fs-repository
response:
status: 200
payload:
snapshots:
- snapshot: my-test-snapshot
- synopsis: Get status of specific snapshot in specific repository.
path: /_snapshot/{repository}/{snapshot}/_status
method: GET
parameters:
repository: my-fs-repository
snapshot: my-test-snapshot
response:
status: 200
payload:
snapshots:
- snapshot: my-test-snapshot
Loading