Class LockServiceClient

java.lang.Object
org.apache.hadoop.hbase.client.locking.LockServiceClient

@LimitedPrivate("Tools") @Evolving public class LockServiceClient extends Object
Helper class to create "master locks" for namespaces, tables and regions. DEV-NOTE: At the moment this class is used only by the RS for MOB, to prevent other MOB compaction to conflict. The RS has already the stub of the LockService, so we have only one constructor that takes the LockService stub. If in the future we are going to use this in other places we should add a constructor that from conf or connection, creates the stub.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final org.apache.hadoop.conf.Configuration
     
    private final NonceGenerator
     
    private final org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockService.BlockingInterface
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LockServiceClient(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockService.BlockingInterface stub, NonceGenerator ng)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockRequest
    buildLockRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockType type, String namespace, TableName tableName, List<RegionInfo> regionInfos, String description, long nonceGroup, long nonce)
     
    namespaceLock(String namespace, String description, Abortable abort)
    LocCreate a new EntityLock object to acquire exclusive lock on a namespace.
    regionLock(List<RegionInfo> regionInfos, String description, Abortable abort)
    Create a new EntityLock object to acquire exclusive lock on multiple regions of same tables.
    tableLock(TableName tableName, boolean exclusive, String description, Abortable abort)
    Create a new EntityLock object to acquire an exclusive or shared lock on a table.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • stub

      private final org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockService.BlockingInterface stub
    • conf

      private final org.apache.hadoop.conf.Configuration conf
    • ng

      private final NonceGenerator ng
  • Constructor Details

    • LockServiceClient

      public LockServiceClient(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockService.BlockingInterface stub, NonceGenerator ng)
  • Method Details

    • tableLock

      public EntityLock tableLock(TableName tableName, boolean exclusive, String description, Abortable abort)
      Create a new EntityLock object to acquire an exclusive or shared lock on a table. Internally, the table namespace will also be locked in shared mode.
    • namespaceLock

      public EntityLock namespaceLock(String namespace, String description, Abortable abort)
      LocCreate a new EntityLock object to acquire exclusive lock on a namespace. Clients can not acquire shared locks on namespace.
    • regionLock

      public EntityLock regionLock(List<RegionInfo> regionInfos, String description, Abortable abort)
      Create a new EntityLock object to acquire exclusive lock on multiple regions of same tables. Internally, the table and its namespace will also be locked in shared mode.
    • buildLockRequest

      @Private public static org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockRequest buildLockRequest(org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos.LockType type, String namespace, TableName tableName, List<RegionInfo> regionInfos, String description, long nonceGroup, long nonce)