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
Modifier and TypeFieldDescriptionprivate boolean
private final org.apache.hadoop.conf.Configuration
private HFileSystem
protected static final org.slf4j.Logger
private final ConcurrentSkipListMap<byte[],
Boolean> private RpcServerInterface
private final AtomicBoolean
private ServerName
private boolean
private ZKWatcher
-
Constructor Summary
ConstructorDescriptionMockRegionServerServices
(org.apache.hadoop.conf.Configuration conf) MockRegionServerServices
(ZKWatcher zkw, ServerName serverName) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort the server or client.void
Add to online regions.createConnection
(org.apache.hadoop.conf.Configuration conf) Returns theAccessChecker
Returns a reference to the servers' async cluster connection.Returns The block cache instance.Returns TheChoreService
instance for this serverdouble
org.apache.hadoop.conf.Configuration
Gets 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!).double
Returns 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.ReturnRegion
instance.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 ofRegionServerRpcQuotaManager
Returns RegionServer's instance ofRegionServerSpaceQuotaManager
ConcurrentSkipListMap<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 ofSecureBulkLoadManager
Returns 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 WALReturnsZKPermissionWatcher
Gets the ZooKeeper instance for this server.boolean
Check if the server or client was aborted.boolean
Returns True if cluster is up; false if cluster is not up (we are shutting down).boolean
Returns True ifStoppable.stop(String)
has been closed.boolean
Returns True is the server is Stoppingvoid
Tasks 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.boolean
registerService
(org.apache.hbase.thirdparty.com.google.protobuf.Service service) Registers a new protocol bufferService
subclass as a coprocessor endpoint to be available for handlingboolean
removeRegion
(HRegion r, ServerName destination) Removes the given Region from the list of onlineRegions.boolean
reportFileArchivalForQuotas
(TableName tableName, Collection<Map.Entry<String, Long>> archivedFiles) Reports a collection of files, and their sizes, that belonged to the giventable
were just moved to the archive directory.boolean
reportRegionSizesForQuotas
(RegionSizeStore sizeStore) Reports the provided Region sizes hosted by this RegionServer to the active Master.boolean
Notify master that a handler requests to change a region statevoid
setFileSystem
(org.apache.hadoop.fs.FileSystem hfs) void
void
Stop this service.void
unassign
(byte[] regionName) Unassign the given region from the current regionserver and assign it randomly.void
updateRegionFavoredNodesMapping
(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, wait
Methods 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:MutableOnlineRegions
Removes the given Region from the list of onlineRegions.- Specified by:
removeRegion
in 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:OnlineRegions
ReturnRegion
instance. Only works if caller is in same context, in same JVM. Region is not serializable.- Specified by:
getRegion
in interfaceOnlineRegions
- Specified by:
getRegion
in interfaceRegionServerServices
- Returns:
- Region for the passed encoded
encodedRegionName
or null if named region is not member of the online regions.
-
getRegions
Description copied from interface:OnlineRegions
Get all online regions of a table in this RS.- Specified by:
getRegions
in interfaceOnlineRegions
- Specified by:
getRegions
in interfaceRegionServerServices
- Returns:
- List of Region
- Throws:
IOException
-
getRegions
Description copied from interface:OnlineRegions
Get all online regions in this RS.- Specified by:
getRegions
in interfaceOnlineRegions
- Specified by:
getRegions
in interfaceRegionServerServices
- Returns:
- List of online Region
-
addRegion
Description copied from interface:MutableOnlineRegions
Add to online regions.- Specified by:
addRegion
in interfaceMutableOnlineRegions
-
postOpenDeployTasks
public void postOpenDeployTasks(RegionServerServices.PostOpenDeployContext context) throws IOException Description copied from interface:RegionServerServices
Tasks to perform after region open to complete deploy of region on regionserver- Specified by:
postOpenDeployTasks
in interfaceRegionServerServices
- Parameters:
context
- the context- Throws:
IOException
-
isStopping
Description copied from interface:Server
Returns True is the server is Stopping- Specified by:
isStopping
in interfaceServer
-
getRpcServer
Description copied from interface:RegionServerServices
Returns a reference to the region server's RPC server- Specified by:
getRpcServer
in interfaceRegionServerServices
-
setRpcServer
-
getRegionsInTransitionInRS
Description copied from interface:RegionServerServices
Get the regions that are currently being opened or closed in the RS- Specified by:
getRegionsInTransitionInRS
in interfaceRegionServerServices
- Returns:
- map of regions in transition in this RS
-
getFlushRequester
- Specified by:
getFlushRequester
in interfaceRegionServerServices
- Returns:
- Implementation of
FlushRequester
or null. Usually it will not be null unless during intialization.
-
getCompactionRequestor
- Specified by:
getCompactionRequestor
in interfaceRegionServerServices
- Returns:
- Implementation of
CompactionRequester
or null. Usually it will not be null unless during intialization.
-
getConnection
Description copied from interface:Server
Returns 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:
getConnection
in interfaceServer
-
getZooKeeper
Description copied from interface:Server
Gets the ZooKeeper instance for this server.- Specified by:
getZooKeeper
in interfaceServer
-
getCoordinatedStateManager
Description copied from interface:Server
Get CoordinatedStateManager instance for this server.- Specified by:
getCoordinatedStateManager
in interfaceServer
-
getRegionServerAccounting
Description copied from interface:RegionServerServices
Returns the RegionServerAccounting for this Region Server- Specified by:
getRegionServerAccounting
in interfaceRegionServerServices
-
getRegionServerRpcQuotaManager
Description copied from interface:RegionServerServices
Returns RegionServer's instance ofRegionServerRpcQuotaManager
- Specified by:
getRegionServerRpcQuotaManager
in interfaceRegionServerServices
-
getServerName
Description copied from interface:Server
Returns The unique server name for this server.- Specified by:
getServerName
in interfaceServer
-
getConfiguration
Description copied from interface:Server
Gets the configuration object for this server.- Specified by:
getConfiguration
in interfaceServer
-
abort
Description copied from interface:Abortable
Abort the server or client. -
stop
Description copied from interface:Stoppable
Stop this service. Implementers should favor logging errors over throwing RuntimeExceptions. -
isStopped
Description copied from interface:Stoppable
Returns True ifStoppable.stop(String)
has been closed. -
isAborted
Description copied from interface:Abortable
Check if the server or client was aborted. -
getFileSystem
Description copied from interface:Server
Returns Return the FileSystem object used (can return null!).- Specified by:
getFileSystem
in interfaceServer
-
setFileSystem
-
getLeaseManager
Description copied from interface:RegionServerServices
Returns The RegionServer's "Leases" service- Specified by:
getLeaseManager
in interfaceRegionServerServices
-
getWALs
Description copied from interface:RegionServerServices
Returns the List of WALs that are used by this server Doesn't include the meta WAL- Specified by:
getWALs
in interfaceRegionServerServices
- Throws:
IOException
-
getWAL
Description copied from interface:RegionServerServices
Returns the WAL for a particular region. Pass null for getting the default (common) WAL- Specified by:
getWAL
in interfaceRegionServerServices
- Throws:
IOException
-
getExecutorService
Description copied from interface:RegionServerServices
Returns hbase executor service- Specified by:
getExecutorService
in interfaceRegionServerServices
-
getChoreService
Description copied from interface:Server
Returns TheChoreService
instance for this server- Specified by:
getChoreService
in interfaceServer
-
updateRegionFavoredNodesMapping
public void updateRegionFavoredNodesMapping(String encodedRegionName, List<org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ServerName> favoredNodes) Description copied from interface:FavoredNodesForRegion
Used to update the favored nodes mapping when required.- Specified by:
updateRegionFavoredNodesMapping
in interfaceFavoredNodesForRegion
-
getFavoredNodesForRegion
Description copied from interface:FavoredNodesForRegion
Get 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:
getFavoredNodesForRegion
in interfaceFavoredNodesForRegion
- Returns:
- array containing the favored nodes' InetSocketAddresses
-
getNonceManager
Description copied from interface:RegionServerServices
Only required for "old" log replay; if it's removed, remove this.- Specified by:
getNonceManager
in interfaceRegionServerServices
- Returns:
- The RegionServer's NonceManager
-
reportRegionStateTransition
public boolean reportRegionStateTransition(RegionServerServices.RegionStateTransitionContext context) Description copied from interface:RegionServerServices
Notify master that a handler requests to change a region state- Specified by:
reportRegionStateTransition
in interfaceRegionServerServices
-
registerService
Description copied from interface:RegionServerServices
Registers a new protocol bufferService
subclass as a coprocessor endpoint to be available for handling- Specified by:
registerService
in interfaceRegionServerServices
- Parameters:
service
- theService
subclass instance to expose as a coprocessor endpoint- Returns:
true
if the registration was successful,false
-
getHeapMemoryManager
Description copied from interface:RegionServerServices
Returns heap memory manager instance- Specified by:
getHeapMemoryManager
in interfaceRegionServerServices
-
getCompactionPressure
- Specified by:
getCompactionPressure
in 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:RegionServerServices
Returns the controller to avoid flush too fast- Specified by:
getFlushThroughputController
in interfaceRegionServerServices
-
getFlushPressure
- Specified by:
getFlushPressure
in 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:RegionServerServices
Returns the metrics tracker for the region server- Specified by:
getMetrics
in interfaceRegionServerServices
-
regionLock
public EntityLock regionLock(List<RegionInfo> regionInfos, String description, Abortable abort) throws IOException Description copied from interface:RegionServerServices
Master based locks on namespaces/tables/regions.- Specified by:
regionLock
in interfaceRegionServerServices
- Throws:
IOException
-
getSecureBulkLoadManager
Description copied from interface:RegionServerServices
Returns RegionServer's instance ofSecureBulkLoadManager
- Specified by:
getSecureBulkLoadManager
in interfaceRegionServerServices
-
unassign
Description copied from interface:RegionServerServices
Unassign 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:
unassign
in interfaceRegionServerServices
- Throws:
IOException
-
getRegionServerSpaceQuotaManager
Description copied from interface:RegionServerServices
Returns RegionServer's instance ofRegionServerSpaceQuotaManager
- Specified by:
getRegionServerSpaceQuotaManager
in interfaceRegionServerServices
-
createConnection
- Specified by:
createConnection
in interfaceServer
- Throws:
IOException
-
reportRegionSizesForQuotas
Description copied from interface:RegionServerServices
Reports the provided Region sizes hosted by this RegionServer to the active Master.- Specified by:
reportRegionSizesForQuotas
in interfaceRegionServerServices
- Parameters:
sizeStore
- The sizes for Regions locally hosted.- Returns:
false
if reporting should be temporarily paused,true
otherwise.
-
reportFileArchivalForQuotas
public boolean reportFileArchivalForQuotas(TableName tableName, Collection<Map.Entry<String, Long>> archivedFiles) Description copied from interface:RegionServerServices
Reports a collection of files, and their sizes, that belonged to the giventable
were just moved to the archive directory.- Specified by:
reportFileArchivalForQuotas
in interfaceRegionServerServices
- Parameters:
tableName
- The name of the table that files previously belonged toarchivedFiles
- Files and their sizes that were moved to archive- Returns:
true
if the files were successfully reported,false
otherwise.
-
isClusterUp
Description copied from interface:RegionServerServices
Returns True if cluster is up; false if cluster is not up (we are shutting down).- Specified by:
isClusterUp
in interfaceRegionServerServices
-
getReplicationSourceService
Description copied from interface:RegionServerServices
Returns Return the object that implements the replication source executorService.- Specified by:
getReplicationSourceService
in interfaceRegionServerServices
-
getTableDescriptors
Description copied from interface:RegionServerServices
Returns Return table descriptors implementation.- Specified by:
getTableDescriptors
in interfaceRegionServerServices
-
getBlockCache
Description copied from interface:RegionServerServices
Returns The block cache instance.- Specified by:
getBlockCache
in interfaceRegionServerServices
-
getMobFileCache
Description copied from interface:RegionServerServices
Returns The cache for mob files.- Specified by:
getMobFileCache
in interfaceRegionServerServices
-
getAccessChecker
Description copied from interface:RegionServerServices
Returns theAccessChecker
- Specified by:
getAccessChecker
in interfaceRegionServerServices
-
getZKPermissionWatcher
Description copied from interface:RegionServerServices
ReturnsZKPermissionWatcher
- Specified by:
getZKPermissionWatcher
in interfaceRegionServerServices
-
getAsyncClusterConnection
Description copied from interface:Server
Returns 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:
getAsyncClusterConnection
in interfaceServer
-
getRegionReplicationBufferManager
- Specified by:
getRegionReplicationBufferManager
in interfaceRegionServerServices
-