HDDS-15765. Fail fast when --node-id is omitted for OM compact/defrag on an HA cluster#10699
Open
chihsuan wants to merge 2 commits into
Open
HDDS-15765. Fail fast when --node-id is omitted for OM compact/defrag on an HA cluster#10699chihsuan wants to merge 2 commits into
chihsuan wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
On an HA OM cluster,
ozone repair om compactandozone admin om snapshot defragwithout--node-iddo 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 keyozone.om.address, which in an HA deployment defaults to0.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-lookingOMNodeDetailsfor0.0.0.0and 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-idis 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 to0.0.0.0. Each command reports the error with its own existing convention.What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15765
How was this patch tested?
TestCompactOMDB#testCompactHAWithoutNodeIdFailsFastandTestDefragSubCommand#testDefragHAWithoutNodeIdFailsFastTestCompactOMDB,TestDefragSubCommand, andTestOMNodeDetailsstill pass, andcheckstyleis clean.compose/ozone-hacluster (om1/om2/om3,service.ids=omservice):ozone repair om compact --cf keyTable(no--node-id)This is an HA OM cluster; specify --node-id ...ozone admin om snapshot defrag(no--node-id)Error: This is an HA OM cluster; specify --node-id ...ozone repair om compact --cf keyTable --service-id omservice --node-id om3Compaction request issued for om.db of om node: om3ozone admin om snapshot defrag --service-id omservice --node-id om3om3:9862om3:9862(not0.0.0.0)Generated-by: Claude Code (Opus 4.8)