Skip to content

HDDS-16631. Fix chooseRandom for rack names with common prefixes - #11401

Open
adwetojha wants to merge 2 commits into
apache:masterfrom
adwetojha:HDDS-16631
Open

adwetojha wants to merge 2 commits into
apache:masterfrom
adwetojha:HDDS-16631

Conversation

@adwetojha

@adwetojha adwetojha commented Oct 3, 2026 •

Copy link
Copy Markdown

What changes were proposed in this pull request?

InnerNodeImpl#getLeaf used a raw string-prefix comparison to determine
whether an excluded scope belonged to a child subtree. As a result, an
excluded path under /r10 was also treated as belonging under /r1,
reducing both subtrees' available leaf counts and causing chooseRandom
to return null even when an eligible node existed.

The change uses Node#isAncestor(String) for topology-aware path
comparison. This preserves exact-node and genuine-descendant exclusions
while respecting path-component boundaries.

A regression test creates nodes under /r1 and /r10, excludes the node
under /r10, and verifies that the node under /r1 is selected.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-16631

How was this patch tested?

  • Focused regression test:
    mvn -ntp -pl :hdds-server-framework test '-Dtest=TestNetworkTopologyImpl#testChooseRandomWithExcludedScopePrefix' -DskipShade -DskipRecon -DskipDocs
  • Full affected module:
    mvn -ntp -pl :hdds-server-framework clean test -DskipShade -DskipRecon -DskipDocs
    (646 tests, 0 failures, 0 errors, 1 skipped)
  • Checkstyle:
    ./hadoop-ozone/dev-support/checks/checkstyle.sh
  • Fork build-branch workflow:
    https://github.com/adwetojha/ozone/actions/runs/37128788136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant