Package org.apache.hadoop.hbase.rsgroup
Class TestRegexBasedRSGroupMembership
java.lang.Object
org.apache.hadoop.hbase.client.AbstractTestUpdateConfiguration
org.apache.hadoop.hbase.rsgroup.TestRSGroupsBase
org.apache.hadoop.hbase.rsgroup.TestRegexBasedRSGroupMembership
@Tag("org.apache.hadoop.hbase.testclassification.RSGroupTests") @Tag("org.apache.hadoop.hbase.testclassification.MediumTests")
public class TestRegexBasedRSGroupMembership
extends TestRSGroupsBase
Black-box tests for regex-based automatic RSGroup membership
(hbase.rsgroup.regex.<groupname>=<regex>), driven entirely through the public
Admin RSGroup API, live RegionServer add/remove against
the minicluster, and captured log output -- no reflection or visibility changes against
RSGroupInfoManagerImpl.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classNested classes/interfaces inherited from class org.apache.hadoop.hbase.rsgroup.TestRSGroupsBase
TestRSGroupsBase.CPMasterObserver, TestRSGroupsBase.MethodName -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread>private static final org.slf4j.Loggerprivate static final StringFields inherited from class org.apache.hadoop.hbase.rsgroup.TestRSGroupsBase
ADMIN, CLUSTER, GROUP_PREFIX, INIT, MASTER, name, NUM_DEAD_SERVERS, NUM_SLAVES_BASE, OBSERVER, TABLE_PREFIX, tableName, TEST_UTIL, WAIT_TIMEOUT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate org.apache.hadoop.hbase.net.AddressaddressOf(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst) voidvoidbeforeMethod(org.junit.jupiter.api.TestInfo testInfo) private static TestRegexBasedRSGroupMembership.LogCapturerprivate voidclearRegex(String groupName) private voidkillFakeRegionServer(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst) private Set<org.apache.hadoop.hbase.net.Address>readStoredServers(String groupName) Reads the server set of a group straight from its row in the hbase:rsgroup table.private voidremoveRegexGroup(String groupName) Tears down a regex-governed group.private voidFails over to a freshly started master (the minicluster's masters are threads): a backup is started, the active master is stopped, and the shared MASTER/ADMIN handles are re-pointed.private voidstatic voidsetUp()private org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThreadstartFakeHostnameRS(String hostname) Starts a genuinely new RegionServer process (thread) in the shared minicluster that reports itself under a caller-chosen hostname, so regex membership rules can target it individually.private voidstopFakeRegionServer(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst) static voidtearDown()voidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidvoidprivate voidServer-membership recompute happens synchronously in theserverAdded/serverRemovedcallback -- it is only ever triggered by an actual server add/remove event, a bare config mutation is not enough.Methods inherited from class org.apache.hadoop.hbase.rsgroup.TestRSGroupsBase
addGroup, deleteGroups, deleteNamespaceIfNecessary, deleteTableIfNecessary, getGroupName, getNameWithoutIndex, getNumServers, getServerName, getTableRegionMap, getTableServerRegionMap, initialize, removeGroup, setUpBeforeMethod, setUpTestBeforeClass, tearDownAfterClass, tearDownAfterMethod, toggleQuotaCheckAndRestartMiniClusterMethods inherited from class org.apache.hadoop.hbase.client.AbstractTestUpdateConfiguration
addResourceToRegionServerConfiguration, replaceHBaseSiteXML, restoreHBaseSiteXML, setUpConfigurationFiles
-
Field Details
-
LOG
-
REGEX_PREFIX
- See Also:
-
fakeRegionServers
private final List<org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread> fakeRegionServers -
regexConfigKeysSet
-
-
Constructor Details
-
TestRegexBasedRSGroupMembership
public TestRegexBasedRSGroupMembership()
-
-
Method Details
-
setUp
- Throws:
Exception
-
tearDown
- Throws:
Exception
-
beforeMethod
- Throws:
Exception
-
afterMethod
- Throws:
Exception
-
startFakeHostnameRS
private org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread startFakeHostnameRS(String hostname) throws Exception Starts a genuinely new RegionServer process (thread) in the shared minicluster that reports itself under a caller-chosen hostname, so regex membership rules can target it individually. The base cluster's real RS all share one real, resolvable hostname (this machine's address); the RPC services constructor unconditionally resolves whatever hostname is configured (independent of any RPC bind-address override), so the caller-chosen hostname here must itself be a real, resolvable, bindable literal -- "127.0.0.1" and "localhost" both work and are guaranteed distinct from the base cluster's real hostname, which is exactly what every test in this class relies on to get a controllable, non-shared identity.- Throws:
Exception
-
stopFakeRegionServer
private void stopFakeRegionServer(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst) throws Exception - Throws:
Exception
-
killFakeRegionServer
private void killFakeRegionServer(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst) throws Exception - Throws:
Exception
-
triggerListenerCycle
Server-membership recompute happens synchronously in theserverAdded/serverRemovedcallback -- it is only ever triggered by an actual server add/remove event, a bare config mutation is not enough. Forces such an event (add+remove a bystander RS) so a config change just made takes effect without requiring an explicit RSGroup admin RPC. Only used by tests that *want* the automatic reconciliation to run and correct things; the trigger RS's own transient membership doesn't affect assertions elsewhere since those only check for specific other servers' addresses.- Throws:
Exception
-
readStoredServers
private Set<org.apache.hadoop.hbase.net.Address> readStoredServers(String groupName) throws IOException Reads the server set of a group straight from its row in the hbase:rsgroup table.- Throws:
IOException
-
restartMaster
Fails over to a freshly started master (the minicluster's masters are threads): a backup is started, the active master is stopped, and the shared MASTER/ADMIN handles are re-pointed. The base class keeps the master's embedded RS in a "master" group, whose stored address would go stale, so the master is first moved back to 'default' (whose membership is live-computed); the next cleanup places the new master in the "master" group again.- Throws:
Exception
-
setRegex
-
removeRegexGroup
Tears down a regex-governed group. Explicit moves that contradict an active regex are rejected, so the regex is first dropped on the master only -- ADMIN's copy still tells VerifyingRSGroupAdmin which servers' membership is regex-driven -- and then the group is emptied and removed.- Throws:
Exception
-
clearRegex
-
addressOf
private org.apache.hadoop.hbase.net.Address addressOf(org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread rst) -
captureRSGroupInfoManagerLog
-
testNoRegexConfigBaseline
- Throws:
Exception
-
testSingleRegexAutoJoinOnLiveAdd
- Throws:
Exception
-
testRegexWithQuantifiersMatches
- Throws:
Exception
-
testFullStringMatchSemantics
- Throws:
Exception
-
testRegexTargetingDefaultGroupIsNoOpAndWarns
- Throws:
Exception
-
testInvalidRegexSyntaxIgnoredAndWarns
- Throws:
Exception
-
testInvalidGroupNameKeyIgnoredAndWarns
- Throws:
Exception
-
testListenerDoesNotStickToStaleServer
- Throws:
Exception
-
testDanglingGroupFallsBackThenResolvesOnceGroupCreated
- Throws:
Exception
-
testAmbiguousMatchFallsBackThenResolvesOnceOverlapFixed
- Throws:
Exception
-
testRegexCoveringEveryServerEmptiesDefaultAndWarns
- Throws:
Exception
-
testCatchAllRegexMovesEveryServerAndGroupTablesStayAssigned
- Throws:
Exception
-
testRegexGovernedGroupMembershipIsNotPersisted
- Throws:
Exception
-
testMoveContradictingRegexIsRejected
- Throws:
Exception
-
testAutomaticMoveDoesNotFireCoprocessorHooks
- Throws:
Exception
-
testRefreshRemovesRegexMatchedServerFromStoredAdminGroup
- Throws:
Exception
-
testNewlyJoinedRegexMemberReceivesRegionsOnBalance
- Throws:
Exception
-
testRestartTriggeredMembershipConfinesTableToGroupServers
- Throws:
Exception
-
testUngracefulCrashOfRegexMemberReassignsRegionsOnlyToOtherGroupMembers
@Test public void testUngracefulCrashOfRegexMemberReassignsRegionsOnlyToOtherGroupMembers() throws Exception- Throws:
Exception
-
testFallbackWhenAllRegexMembersCrash
- Throws:
Exception
-
testExplicitMoveFromDefaultToAdminGroupTriggersRandomAssignmentBackToDefault
@Test public void testExplicitMoveFromDefaultToAdminGroupTriggersRandomAssignmentBackToDefault() throws Exception- Throws:
Exception
-