HBASE-30411 Support regex based RS membership assignment to RS group - #8734
Open
sanjeet006py wants to merge 13 commits into
Open
sanjeet006py wants to merge 13 commits into
sanjeet006py wants to merge 13 commits into
Conversation
added 12 commits
September 28, 2026 16:55
Adds hbase.rsgroup.regex.<groupname> config keys so a new RegionServer's hostname can be automatically mapped to an existing RSGroup instead of always landing in default. Enforced as a hard invariant on every flushConfig call, online and offline; ambiguous or dangling-group matches fall back to default and are logged, never enforced; a regex targeting the reserved default group name is dropped at parse time. (cherry picked from commit 4c08b42)
… clarity Extract the repeated online/admin-managed-server computation and the empty-default-group guard across reconcileRegexGroupMembership, checkRegexGroupMembership, and computeRegexGroupAssignments into a shared resolveServerAddrToRSGroupNameSafely helper. Also rename several variables and methods added for this feature (byName, actualGroupOf, regexGroupMap, regexAssignments, etc.) to be more self-descriptive. (cherry picked from commit e7a54df)
(cherry picked from commit 98e1819)
- addGroup/removeGroup (TestRSGroupsBase) now assert the resulting RSGroupInfo/default-group state instead of only performing the move. - TestRSGroupsRegexMembership gains RSGroupInfo assertions after each admin op in the unrelated-ops and coprocessor-hook tests, and the drift test now also verifies the rejected rename left no partial state, then fixes the regex and confirms the retry succeeds. - Rename TestRSGroupsRegexMembership to TestRegexBasedRSGroupMembership. (cherry picked from commit a438dbb)
Cover two additional scenarios for regex-based automatic RSGroup membership: a new RS auto-joining an already-active regex-governed group and receiving regions on balance, and a restart-triggered membership reconciliation that confines a table's regions to the group's members bidirectionally. (cherry picked from commit 48161d4)
(cherry picked from commit 261ff7b)
Kills a regex-governed RSGroup member and verifies ServerCrashProcedure's default forceNewPlan=true confines recovered regions to the crashed member's own group -- never to default or an unrelated group borrowed from it -- via roundRobinAssignment rather than retainAssignment. Adds test-only static call-tracking flags to RSGroupBasedLoadBalancer (reset/read only from src/test, guarded by @RestrictedApi) so tests can assert which of randomAssignment/retainAssignment/roundRobinAssignment actually ran, instead of only inferring it from the outcome. (cherry picked from commit 4655238)
Add testFallbackWhenAllServersOfMultiServerGroupCrash (TestRSGroupsFallback) and testFallbackWhenAllRegexMembersCrash (TestRegexBasedRSGroupMembership), covering hbase.rsgroup.fallback.enable=true when a multi-server group -- admin-managed or regex-governed -- loses every one of its servers and its table's regions must fall back to default. Add setFallbackEnabledForTest on RSGroupBasedLoadBalancer so the regex-membership test class, which shares one cluster/balancer across all its tests, can toggle fallback per test without a cluster restart. Add INFO logging across RSGroupInfoManagerImpl's regex-based RSGroup membership resolution, reconciliation, computation, and validation paths to aid diagnosing regex-membership behavior in production. (cherry picked from commit 41c5c4b)
The multi-server-group fallback test added on the branch-2.6 feature branch is out of scope for the branch-2 port of regex-based RSGroup membership; drop it so this branch only carries the regex-membership feature and its own tests.
Rename/refactor resolveServerAddrToRSGroupNameSafely into resolveRegexBasedRSGroupMembership operating on Set<Address> instead of List<ServerName>, and replace the separate reconcileRegexBasedRSGroupMembership/computeRegexBasedRSGroupMembership/ updateRSGroupsServers/getOnlineRS/getDefaultServers methods with a single computeAutoManagedRSGroupServers/applyAutoManagedRSGroupServers/ updateAutoManagedRSGroupServers path, so 'default' and every regex-governed group's server membership is always recomputed from live ServerManager state and never trusted from storage. In refresh(), replace the stale 'default' RSGroupInfo loaded from the group table/zk instead of appending a second one, so groupList itself only ever holds one DEFAULT_GROUP entry. In ServerEventsListenerThread, track pending events with a volatile int eventCount instead of a boolean flag, matching master, and guard its decrement so it cannot go negative.
…sh-target assumption in its test RSGroupInfoManagerImpl#ServerEventsListenerThread decremented eventCount before checking whether an event was actually pending, so a serverAdded/ serverRemoved event arriving in that narrow window could be silently absorbed without ever being processed, permanently stalling the thread in wait(). Move the decrement to after the while-loop confirms eventCount > 0, matching the upstream master fix. TestRegexBasedRSGroupMembership#testUngracefulCrashOfRegexMemberReassignsRegionsOnlyToOtherGroupMembers hardcoded sn1 as the crash target, but retainAssignment's random fallback can occasionally place all regions on sn2 alone, leaving nothing for ServerCrashProcedure to reassign. Crash whichever server actually holds regions instead.
…ement Matches master's pattern exactly: block on the eventCount wait-loop first, then run updateAutoManagedRSGroupServers(), then decrement eventCount in a separate synchronized block afterward. Previously this thread ran the update unconditionally on every loop iteration before checking for a pending event; now it only processes once an event is actually pending.
virajjasani
self-requested a review
October 2, 2026 19:19
Drop redundant volatile on eventCount (already fully guarded by synchronized(this) in ServerEventsListenerThread) and rewrite checkOnlyServerSetsDifferForAutoUpdate to iterate entrySet instead of re-looking-up each value from keySet. Convert the test-only assignment-invocation flags in RSGroupBasedLoadBalancer from public static fields to private instance fields with @RestrictedApi-annotated getters, mirroring the existing setFallbackEnabledForTest/setRsGroupInfoManager pattern. This resolves ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD at the source instead of suppressing it, since the write is no longer to a static field.
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.
JIRA: HBASE-30411