Skip to content

HBASE-27878 Fix NPE in balancing rsgroup - #8664

Open
Huginn-kio wants to merge 1 commit into
apache:masterfrom
Huginn-kio:HBASE-27878
Open

Huginn-kio wants to merge 1 commit into
apache:masterfrom
Huginn-kio:HBASE-27878

Conversation

@Huginn-kio

@Huginn-kio Huginn-kio commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

HBASE-27878

Summary

balance_rsgroup can fail with a NullPointerException when an assignment has no current
region server. This change builds the RSGroup balancer input through the common
RegionStates#getAssignmentsForBalancer(...) path.

https://issues.apache.org/jira/browse/HBASE-27878

Root cause

RSGroupInfoManagerImpl#getRSGroupAssignmentsByTable copied entries directly from
RegionStates#getRegionAssignments(). A region with a null current location could
therefore become a null server key, and RSGroupBasedLoadBalancer#correctAssignments
then called getAddress() on that key.

Fix

  • Collect online servers in the requested RSGroup and delegate assignment collection to
    RegionStates#getAssignmentsForBalancer(...).
  • Reuse the common balancer filtering for null locations, disabled tables, and regions
    that are not OPEN or OPENING, while preserving default-group table membership.
  • Add a regression test covering a region with a null current server and preserving
    disabled-table filtering.

Testing

  • TestRSGroupsBalance#testGetRSGroupAssignmentsByTable passed with 1 test run, 0 failures, and
    0 errors.
  • Neighbor regression slice: TestRSGroupsBalance passed with 4 tests, 0 failures,
    and 0 errors.
  • RAT passed with 0 unapproved or unknown licenses.
  • SpotBugs passed with 0 bugs and 0 errors.
  • Diff-level Checkstyle is clean. A module-wide Checkstyle run reports pre-existing
    violations outside this change.

Compatibility

  • Public API impact: none.
  • Config impact: none.
  • Persisted format impact: none.
  • Wire format impact: none.

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