chihsuan opened a new pull request, #10699:
URL: https://github.com/apache/ozone/pull/10699

   ## What changes were proposed in this pull request?
   
   On an HA OM cluster, `ozone repair om compact` and `ozone admin om snapshot 
defrag` without `--node-id` do not fail cleanly; they hang for a long time 
before eventually timing out.
   
   Root cause: with no `--node-id`/`--service-id`, 
`OMNodeDetails.getOMNodeDetailsFromConf(conf, null, null)` falls back to the 
base config key `ozone.om.address`, which in an HA deployment defaults to 
`0.0.0.0:9862`. That default is the OM *server bind* address (bind to all 
interfaces) and is meaningless as a *client* target. Because it resolves to a 
non-null (but useless) address, the tool builds a valid-looking `OMNodeDetails` 
for `0.0.0.0` and proceeds to the RPC, which then retries in the Hadoop IPC 
retry loop and blocks.
   
   This PR adds a fail-fast check in both CLI commands: when `--node-id` is 
omitted but the config defines an HA service 
(`OmUtils.isServiceIdsDefined(conf)`), the command exits immediately and asks 
the operator to specify `--node-id`, instead of resolving to `0.0.0.0`. Each 
command reports the error with its own existing convention (repair's `error()`, 
admin's `System.err`).
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15765
   
   ## How was this patch tested?
   
   New unit tests `TestCompactOMDB#testCompactHAWithoutNodeIdFailsFast` and 
`TestDefragSubCommand#testDefragHAWithoutNodeIdFailsFast` assert the fail-fast 
message is printed and no RPC is issued (both fail without the fix). Existing 
`TestCompactOMDB`, `TestDefragSubCommand`, and `TestOMNodeDetails` still pass, 
and `checkstyle` is clean.
   
   Manual end-to-end run on the `compose/ozone-ha` cluster (om1/om2/om3, 
`service.ids=omservice`):
   
   | Command | Before | After |
   |---|---|---|
   | `ozone repair om compact --cf keyTable` (no `--node-id`) | hangs until 
timeout | returns immediately: `This is an HA OM cluster; specify --node-id 
...` |
   | `ozone admin om snapshot defrag` (no `--node-id`) | hangs until timeout | 
returns immediately: `Error: This is an HA OM cluster; specify --node-id ...` |
   | `ozone repair om compact --cf keyTable --service-id omservice --node-id 
om3` | issues request | unchanged: `Compaction request issued for om.db of om 
node: om3` |
   | `ozone admin om snapshot defrag --service-id omservice --node-id om3` | 
reaches `om3:9862` | unchanged: reaches real `om3:9862` (not `0.0.0.0`) |
   
   Generated-by: Claude Code (Opus 4.8)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to