-
Notifications
You must be signed in to change notification settings - Fork 249
feat: Implement operationId support in backup operations and status retrieval #1189
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look
test/intergration_test.go
test failed
2025-07-23T11:06:26.9842739Z integration_test.go:4071:
2025-07-23T11:06:26.9844263Z Error Trace: /home/runner/work/clickhouse-backup/clickhouse-backup/test/integration/integration_test.go:4071
2025-07-23T11:06:26.9847086Z /home/runner/work/clickhouse-backup/clickhouse-backup/test/integration/integration_test.go:1228
2025-07-23T11:06:26.9849770Z /home/runner/work/clickhouse-backup/clickhouse-backup/test/integration/integration_test.go:1171
2025-07-23T11:06:26.9850726Z Error: Received unexpected error:
2025-07-23T11:06:26.9852169Z code: 117, message: Unknown field found while parsing JSONEachRow format: operation_id
2025-07-23T11:06:26.9852909Z Test: TestServerAPI
- Updated ClickHouse table schema for system.backup_actions to include operation_id field - This fixes JSONEachRow parsing error when the API returns ActionRowStatus with operation_id - Updated both the actual table creation query and documentation comment
Could you let me know if I should update the README as part of this PR, or will one of the maintainers take care of it after approval? |
Pull Request Test Coverage Report for Build 16474847974Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please change ReadMe.md with related changes.
I’ve updated the ReadMe.md and Examples.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, actually you already have commandId
Why just not return it in all cases when status.Start
and poll status with CommandId instead of new operation_id?
or maybe it makes sense to move away from using two different IDs, stick with only one, and implement its generation using UUID? |
ok. got it, let's merge |
Pull Request Description
Add operationId query parameter support for /backup/status endpoint
Overview
This PR adds support for the
operationid
query parameter to the/backup/status
endpoint, allowing users to retrieve the status of a specific operation by its ID.Problem
Currently, the
/backup/status
endpoint only returns the status of the most recent operation. When multiple backup operations are running or have been executed, there's no way to check the status of a specific operation using itsoperation_id
that was returned during operation creation.Solution
ActionRowStatus
struct withOperationId
field to store operation IDs in status trackingAsyncStatus
:StartWithOperationId()
- starts commands with explicit operationIdGetStatusByOperationId()
- retrieves status by operationIdStartWithOperationId
/backup/status
endpoint to support optionaloperationid
query parameterAPI Usage
Get status of all operations (existing behavior):
Get status of specific operation by operationId:
Example Workflow
Backward Compatibility
✅ Fully backward compatible
operationid
parameter is optionaloperationid
is not provided, behavior is identical to current implementationLimitations
[]
Testing
Files Changed
pkg/status/status.go
- Extended structures and added new methodspkg/server/server.go
- Updated handlers and httpStatusHandlerThis enhancement improves the API usability for monitoring specific operations while maintaining full backward compatibility.