Package org.apache.hadoop.hbase
Class MockRegionServerServices
java.lang.Object
org.apache.hadoop.hbase.MockRegionServerServices
- All Implemented Interfaces:
Abortable,FavoredNodesForRegion,MutableOnlineRegions,OnlineRegions,RegionServerServices,Server,Stoppable
Basic mock region server services. Should only be instantiated by HBaseTestingUtility.b
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.regionserver.RegionServerServices
RegionServerServices.PostOpenDeployContext, RegionServerServices.RegionStateTransitionContext -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate final org.apache.hadoop.conf.Configurationprivate HFileSystemprotected static final org.slf4j.Loggerprivate final ConcurrentSkipListMap<byte[],Boolean> private RpcServerInterfaceprivate final AtomicBooleanprivate ServerNameprivate booleanprivate ZKWatcher -
Constructor Summary
ConstructorsConstructorDescriptionMockRegionServerServices(org.apache.hadoop.conf.Configuration conf) MockRegionServerServices(ZKWatcher zkw, ServerName serverName) -
Method Summary
Modifier and TypeMethodDescriptionvoidAbort the server or client.voidAdd to online regions.createConnection(org.apache.hadoop.conf.Configuration conf) Returns theAccessCheckerReturns a reference to the servers' async cluster connection.Returns The block cache instance.Returns TheChoreServiceinstance for this serverdoubleorg.apache.hadoop.conf.ConfigurationGets the configuration object for this server.Returns a reference to the servers' connection.Get CoordinatedStateManager instance for this server.Returns hbase executor servicegetFavoredNodesForRegion(String encodedRegionName) Get the favored nodes mapping for this region.Returns Return the FileSystem object used (can return null!).doubleReturns the controller to avoid flush too fastReturns heap memory manager instanceReturns The RegionServer's "Leases" serviceReturns the metrics tracker for the region serverReturns The cache for mob files.Only required for "old" log replay; if it's removed, remove this.ReturnRegioninstance.Get all online regions in this RS.getRegions(TableName tableName) Get all online regions of a table in this RS.Returns the RegionServerAccounting for this Region ServerReturns RegionServer's instance ofRegionServerRpcQuotaManagerReturns RegionServer's instance ofRegionServerSpaceQuotaManagerConcurrentSkipListMap<byte[],Boolean> Get the regions that are currently being opened or closed in the RSReturns Return the object that implements the replication source executorService.Returns a reference to the region server's RPC serverReturns RegionServer's instance ofSecureBulkLoadManagerReturns The unique server name for this server.Returns Return table descriptors implementation.getWAL(RegionInfo regionInfo) Returns the WAL for a particular region.getWALs()Returns the List of WALs that are used by this server Doesn't include the meta WALReturnsZKPermissionWatcherGets the ZooKeeper instance for this server.booleanCheck if the server or client was aborted.booleanReturns True if cluster is up; false if cluster is not up (we are shutting down).booleanReturns True ifStoppable.stop(String)has been closed.booleanReturns True is the server is StoppingvoidTasks to perform after region open to complete deploy of region on regionserverregionLock(List<RegionInfo> regionInfos, String description, Abortable abort) Master based locks on namespaces/tables/regions.booleanregisterService(org.apache.hbase.thirdparty.com.google.protobuf.Service service) Registers a new protocol bufferServicesubclass as a coprocessor endpoint to be available for handlingbooleanremoveRegion(HRegion r, ServerName destination) Removes the given Region from the list of onlineRegions.booleanreportFileArchivalForQuotas(TableName tableName, Collection<Map.Entry<String, Long>> archivedFiles) Reports a collection of files, and their sizes, that belonged to the giventablewere just moved to the archive directory.booleanreportRegionSizesForQuotas(RegionSizeStore sizeStore) Reports the provided Region sizes hosted by this RegionServer to the active Master.booleanNotify master that a handler requests to change a region statevoidsetFileSystem(org.apache.hadoop.fs.FileSystem hfs) voidvoidStop this service.voidunassign(byte[] regionName) Unassign the given region from the current regionserver and assign it randomly.voidupdateRegionFavoredNodesMapping(String encodedRegionName, List<org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName> favoredNodes) Used to update the favored nodes mapping when required.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.Server
getAsyncConnection
-
Field Details
-
LOG
-
regions
-
rit
-
hfs
-
conf
-
zkw
-
serverName
-
rpcServer
-
abortRequested
-
stopping
-
running
-
-
Constructor Details
-
MockRegionServerServices
-
MockRegionServerServices
-
MockRegionServerServices
public MockRegionServerServices() -
MockRegionServerServices
-
-
Method Details
-
removeRegion
Description copied from interface:MutableOnlineRegionsRemoves the given Region from the list of onlineRegions.- Specified by:
removeRegionin interfaceMutableOnlineRegions- Parameters:
r- Region to remove.destination- Destination, if any, null otherwise.- Returns:
- True if we removed a region from online list.
-
getRegion
Description copied from interface:OnlineRegionsReturnRegioninstance. Only works if caller is in same context, in same JVM. Region is not serializable.- Specified by:
getRegionin interfaceOnlineRegions- Specified by:
getRegionin interfaceRegionServerServices- Returns:
- Region for the passed encoded
encodedRegionNameor null if named region is not member of the online regions.
-
getRegions
Description copied from interface:OnlineRegionsGet all online regions of a table in this RS.- Specified by:
getRegionsin interfaceOnlineRegions- Specified by:
getRegionsin interfaceRegionServerServices- Returns:
- List of Region
- Throws:
IOException
-
getRegions
Description copied from interface:OnlineRegionsGet all online regions in this RS.- Specified by:
getRegionsin interfaceOnlineRegions- Specified by:
getRegionsin interfaceRegionServerServices- Returns:
- List of online Region
-
addRegion
Description copied from interface:MutableOnlineRegionsAdd to online regions.- Specified by:
addRegionin interfaceMutableOnlineRegions
-
postOpenDeployTasks
public void postOpenDeployTasks(RegionServerServices.PostOpenDeployContext context) throws IOException Description copied from interface:RegionServerServicesTasks to perform after region open to complete deploy of region on regionserver- Specified by:
postOpenDeployTasksin interfaceRegionServerServices- Parameters:
context- the context- Throws:
IOException
-
isStopping
Description copied from interface:ServerReturns True is the server is Stopping- Specified by:
isStoppingin interfaceServer
-
getRpcServer
Description copied from interface:RegionServerServicesReturns a reference to the region server's RPC server- Specified by:
getRpcServerin interfaceRegionServerServices
-
setRpcServer
-
getRegionsInTransitionInRS
Description copied from interface:RegionServerServicesGet the regions that are currently being opened or closed in the RS- Specified by:
getRegionsInTransitionInRSin interfaceRegionServerServices- Returns:
- map of regions in transition in this RS
-
getFlushRequester
- Specified by:
getFlushRequesterin interfaceRegionServerServices- Returns:
- Implementation of
FlushRequesteror null. Usually it will not be null unless during intialization.
-
getCompactionRequestor
- Specified by:
getCompactionRequestorin interfaceRegionServerServices- Returns:
- Implementation of
CompactionRequesteror null. Usually it will not be null unless during intialization.
-
getConnection
Description copied from interface:ServerReturns a reference to the servers' connection. Important note: this method returns a reference to Connection which is managed by Server itself, so callers must NOT attempt to close connection obtained.- Specified by:
getConnectionin interfaceServer
-
getZooKeeper
Description copied from interface:ServerGets the ZooKeeper instance for this server.- Specified by:
getZooKeeperin interfaceServer
-
getCoordinatedStateManager
Description copied from interface:ServerGet CoordinatedStateManager instance for this server.- Specified by:
getCoordinatedStateManagerin interfaceServer
-
getRegionServerAccounting
Description copied from interface:RegionServerServicesReturns the RegionServerAccounting for this Region Server- Specified by:
getRegionServerAccountingin interfaceRegionServerServices
-
getRegionServerRpcQuotaManager
Description copied from interface:RegionServerServicesReturns RegionServer's instance ofRegionServerRpcQuotaManager- Specified by:
getRegionServerRpcQuotaManagerin interfaceRegionServerServices
-
getServerName
Description copied from interface:ServerReturns The unique server name for this server.- Specified by:
getServerNamein interfaceServer
-
getConfiguration
Description copied from interface:ServerGets the configuration object for this server.- Specified by:
getConfigurationin interfaceServer
-
abort
Description copied from interface:AbortableAbort the server or client. -
stop
Description copied from interface:StoppableStop this service. Implementers should favor logging errors over throwing RuntimeExceptions. -
isStopped
Description copied from interface:StoppableReturns True ifStoppable.stop(String)has been closed. -
isAborted
Description copied from interface:AbortableCheck if the server or client was aborted. -
getFileSystem
Description copied from interface:ServerReturns Return the FileSystem object used (can return null!).- Specified by:
getFileSystemin interfaceServer
-
setFileSystem
-
getLeaseManager
Description copied from interface:RegionServerServicesReturns The RegionServer's "Leases" service- Specified by:
getLeaseManagerin interfaceRegionServerServices
-
getWALs
Description copied from interface:RegionServerServicesReturns the List of WALs that are used by this server Doesn't include the meta WAL- Specified by:
getWALsin interfaceRegionServerServices- Throws:
IOException
-
getWAL
Description copied from interface:RegionServerServicesReturns the WAL for a particular region. Pass null for getting the default (common) WAL- Specified by:
getWALin interfaceRegionServerServices- Throws:
IOException
-
getExecutorService
Description copied from interface:RegionServerServicesReturns hbase executor service- Specified by:
getExecutorServicein interfaceRegionServerServices
-
getChoreService
Description copied from interface:ServerReturns TheChoreServiceinstance for this server- Specified by:
getChoreServicein interfaceServer
-
updateRegionFavoredNodesMapping
public void updateRegionFavoredNodesMapping(String encodedRegionName, List<org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName> favoredNodes) Description copied from interface:FavoredNodesForRegionUsed to update the favored nodes mapping when required.- Specified by:
updateRegionFavoredNodesMappingin interfaceFavoredNodesForRegion
-
getFavoredNodesForRegion
Description copied from interface:FavoredNodesForRegionGet the favored nodes mapping for this region. Used when the HDFS create API is invoked to pass in favored nodes hints for new region files.- Specified by:
getFavoredNodesForRegionin interfaceFavoredNodesForRegion- Returns:
- array containing the favored nodes' InetSocketAddresses
-
getNonceManager
Description copied from interface:RegionServerServicesOnly required for "old" log replay; if it's removed, remove this.- Specified by:
getNonceManagerin interfaceRegionServerServices- Returns:
- The RegionServer's NonceManager
-
reportRegionStateTransition
public boolean reportRegionStateTransition(RegionServerServices.RegionStateTransitionContext context) Description copied from interface:RegionServerServicesNotify master that a handler requests to change a region state- Specified by:
reportRegionStateTransitionin interfaceRegionServerServices
-
registerService
Description copied from interface:RegionServerServicesRegisters a new protocol bufferServicesubclass as a coprocessor endpoint to be available for handling- Specified by:
registerServicein interfaceRegionServerServices- Parameters:
service- theServicesubclass instance to expose as a coprocessor endpoint- Returns:
trueif the registration was successful,false
-
getHeapMemoryManager
Description copied from interface:RegionServerServicesReturns heap memory manager instance- Specified by:
getHeapMemoryManagerin interfaceRegionServerServices
-
getCompactionPressure
- Specified by:
getCompactionPressurein interfaceRegionServerServices- Returns:
- the max compaction pressure of all stores on this regionserver. The value should be greater than or equal to 0.0, and any value greater than 1.0 means we enter the emergency state that some stores have too many store files.
- See Also:
-
getFlushThroughputController
Description copied from interface:RegionServerServicesReturns the controller to avoid flush too fast- Specified by:
getFlushThroughputControllerin interfaceRegionServerServices
-
getFlushPressure
- Specified by:
getFlushPressurein interfaceRegionServerServices- Returns:
- the flush pressure of all stores on this regionserver. The value should be greater than or equal to 0.0, and any value greater than 1.0 means we enter the emergency state that global memstore size already exceeds lower limit.
-
getMetrics
Description copied from interface:RegionServerServicesReturns the metrics tracker for the region server- Specified by:
getMetricsin interfaceRegionServerServices
-
regionLock
public EntityLock regionLock(List<RegionInfo> regionInfos, String description, Abortable abort) throws IOException Description copied from interface:RegionServerServicesMaster based locks on namespaces/tables/regions.- Specified by:
regionLockin interfaceRegionServerServices- Throws:
IOException
-
getSecureBulkLoadManager
Description copied from interface:RegionServerServicesReturns RegionServer's instance ofSecureBulkLoadManager- Specified by:
getSecureBulkLoadManagerin interfaceRegionServerServices
-
unassign
Description copied from interface:RegionServerServicesUnassign the given region from the current regionserver and assign it randomly. Could still be assigned to us. This is used to solve some tough problems for which you need to reset the state of a region. For example, if you hit FileNotFound exception and want to refresh the store file list.See HBASE-17712 for more details.
- Specified by:
unassignin interfaceRegionServerServices- Throws:
IOException
-
getRegionServerSpaceQuotaManager
Description copied from interface:RegionServerServicesReturns RegionServer's instance ofRegionServerSpaceQuotaManager- Specified by:
getRegionServerSpaceQuotaManagerin interfaceRegionServerServices
-
createConnection
- Specified by:
createConnectionin interfaceServer- Throws:
IOException
-
reportRegionSizesForQuotas
Description copied from interface:RegionServerServicesReports the provided Region sizes hosted by this RegionServer to the active Master.- Specified by:
reportRegionSizesForQuotasin interfaceRegionServerServices- Parameters:
sizeStore- The sizes for Regions locally hosted.- Returns:
falseif reporting should be temporarily paused,trueotherwise.
-
reportFileArchivalForQuotas
public boolean reportFileArchivalForQuotas(TableName tableName, Collection<Map.Entry<String, Long>> archivedFiles) Description copied from interface:RegionServerServicesReports a collection of files, and their sizes, that belonged to the giventablewere just moved to the archive directory.- Specified by:
reportFileArchivalForQuotasin interfaceRegionServerServices- Parameters:
tableName- The name of the table that files previously belonged toarchivedFiles- Files and their sizes that were moved to archive- Returns:
trueif the files were successfully reported,falseotherwise.
-
isClusterUp
Description copied from interface:RegionServerServicesReturns True if cluster is up; false if cluster is not up (we are shutting down).- Specified by:
isClusterUpin interfaceRegionServerServices
-
getReplicationSourceService
Description copied from interface:RegionServerServicesReturns Return the object that implements the replication source executorService.- Specified by:
getReplicationSourceServicein interfaceRegionServerServices
-
getTableDescriptors
Description copied from interface:RegionServerServicesReturns Return table descriptors implementation.- Specified by:
getTableDescriptorsin interfaceRegionServerServices
-
getBlockCache
Description copied from interface:RegionServerServicesReturns The block cache instance.- Specified by:
getBlockCachein interfaceRegionServerServices
-
getMobFileCache
Description copied from interface:RegionServerServicesReturns The cache for mob files.- Specified by:
getMobFileCachein interfaceRegionServerServices
-
getAccessChecker
Description copied from interface:RegionServerServicesReturns theAccessChecker- Specified by:
getAccessCheckerin interfaceRegionServerServices
-
getZKPermissionWatcher
Description copied from interface:RegionServerServicesReturnsZKPermissionWatcher- Specified by:
getZKPermissionWatcherin interfaceRegionServerServices
-
getAsyncClusterConnection
Description copied from interface:ServerReturns a reference to the servers' async cluster connection. Important note: this method returns a reference to Connection which is managed by Server itself, so callers must NOT attempt to close connection obtained.- Specified by:
getAsyncClusterConnectionin interfaceServer
-
getRegionReplicationBufferManager
- Specified by:
getRegionReplicationBufferManagerin interfaceRegionServerServices
-