HDDS-13640. Add CLI that allows manually triggering snapshot defrag#9155
HDDS-13640. Add CLI that allows manually triggering snapshot defrag#9155swamirishi merged 19 commits intoapache:masterfrom
Conversation
…n om triggerSnapshotDefrag -host=om` (cherry picked from commit 3de45ba)
There was a problem hiding this comment.
Pull Request Overview
This PR adds a CLI command to manually trigger the snapshot defragmentation service in Ozone Manager, allowing administrators to initiate snapshot defrag operations on demand.
Key changes:
- Added new protobuf message types for snapshot defrag requests/responses
- Implemented the snapshot defrag trigger functionality in OzoneManager with admin privilege checks
- Created a new CLI subcommand
triggerSnapshotDefragwith options for service ID, host, and no-wait execution
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| OmClientProtocol.proto | Added SnapshotDefrag message types and enum value |
| OzoneManagerProtocol.java | Added triggerSnapshotDefrag method to protocol interface |
| OzoneManager.java | Implemented snapshot defrag trigger with security checks and async execution |
| OzoneManagerRequestHandler.java | Added request handling for SnapshotDefrag type |
| OzoneManagerProtocolClientSideTranslatorPB.java | Added client-side implementation for snapshot defrag requests |
| OmUtils.java | Added SnapshotDefrag to read-only operation types |
| TriggerSnapshotDefragSubCommand.java | New CLI command implementation |
| OMAdmin.java | Registered new subcommand with OM admin CLI |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Outdated
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Outdated
Show resolved
Hide resolved
...li-admin/src/main/java/org/apache/hadoop/ozone/admin/om/TriggerSnapshotDefragSubCommand.java
Outdated
Show resolved
Hide resolved
A better CLI name would probably be |
Prompt (Claude Sonnet 4.5): Instead of using OzoneManagerProtocol client, this should use OMAdminProtocolClientSideImpl just like CompactOMDB.java does. Can you make the series of changes?
Good idea! Done |
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Show resolved
Hide resolved
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
Outdated
Show resolved
Hide resolved
...ommon/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OMAdminProtocolClientSideImpl.java
Outdated
Show resolved
Hide resolved
...zone/cli-admin/src/main/java/org/apache/hadoop/ozone/admin/om/snapshot/DefragSubCommand.java
Outdated
Show resolved
Hide resolved
...egration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDefragAdmin.java
Outdated
Show resolved
Hide resolved
...egration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDefragAdmin.java
Outdated
Show resolved
Hide resolved
jojochuang
left a comment
There was a problem hiding this comment.
A few minor issues but overall good to me. I'd suggest to merge it and fix the rest in a follow up task.
| @CommandLine.Option( | ||
| names = {"--node-id"}, | ||
| description = "NodeID of the OM to trigger snapshot defragmentation on.", | ||
| required = false |
There was a problem hiding this comment.
if this is not required, which OM node is going to be used?
There was a problem hiding this comment.
This has to be specified, with the current framework of how OMNodeDetails is retrieved. It won't select OM leader as I initially expected. So I added that null check.
...egration-test/src/test/java/org/apache/hadoop/ozone/om/snapshot/TestSnapshotDefragAdmin.java
Show resolved
Hide resolved
…ozone/om/snapshot/TestSnapshotDefragAdmin.java Co-authored-by: Wei-Chiu Chuang <jojochuang@gmail.com>
|
thanks for the patch @smengcl . Thank you @jojochuang for reviewing the patch |
What changes were proposed in this pull request?
Add a CLI subcommand that allows snapshot defrag service to be manually triggered.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-13640
How was this patch tested?