镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

HBASE-30411 Support regex based RS membership assignment to RS group - #8734

Open
sanjeet006py wants to merge 13 commits into
apache:branch-2from
sanjeet006py:rsgroup-membership-regex-branch-2
Open

sanjeet006py wants to merge 13 commits into
apache:branch-2from
sanjeet006py:rsgroup-membership-regex-branch-2

Conversation

@sanjeet006py

Copy link
Copy Markdown
Contributor

JIRA: HBASE-30411

Sanjeet Malhotra 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
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.
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