Class MasterProcedureManager
java.lang.Object
org.apache.hadoop.hbase.procedure.ProcedureManager
org.apache.hadoop.hbase.procedure.MasterProcedureManager
- All Implemented Interfaces:
Stoppable
- Direct Known Subclasses:
LogRollMasterProcedureManager
,MasterFlushTableProcedureManager
,SnapshotManager
A life-cycle management interface for globally barriered procedures on master. See the following
doc on details of globally barriered procedure:
https://issues.apache.org/jira/secure/attachment/12555103/121127-global-barrier-proc.pdf To
implement a custom globally barriered procedure, user needs to extend two classes:
MasterProcedureManager
and RegionServerProcedureManager
. Implementation of
MasterProcedureManager
is loaded into HMaster
process via configuration parameter 'hbase.procedure.master.classes', while implementation of
RegionServerProcedureManager
is loaded into
HRegionServer
process via configuration parameter
'hbase.procedure.regionserver.classes'. An example of globally barriered procedure implementation
is SnapshotManager
and
RegionServerSnapshotManager
. A globally
barriered procedure is identified by its signature (usually it is the name of the procedure
znode). During the initialization phase, the initialize methods are called by both
HMaster
and
HRegionServer
which create the procedure znode and
register the listeners. A procedure can be triggered by its signature and an instant name
(encapsulated in a HBaseProtos.ProcedureDescription
object). When the servers are shutdown, the stop
methods on both classes are called to clean up the data associated with the procedure.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
checkPermissions
(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc, AccessChecker accessChecker, User user) Check for required permissions before executing the procedure.void
execProcedure
(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) Execute a distributed procedure on clusterbyte[]
execProcedureWithRet
(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) Execute a distributed procedure on cluster with return data.abstract void
initialize
(MasterServices master, MetricsMaster metricsMaster) Initialize a globally barriered procedure for master.abstract boolean
isProcedureDone
(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) Check if the procedure is finished successfullyMethods inherited from class org.apache.hadoop.hbase.procedure.ProcedureManager
equals, getProcedureSignature, hashCode
-
Constructor Details
-
MasterProcedureManager
public MasterProcedureManager()
-
-
Method Details
-
initialize
public abstract void initialize(MasterServices master, MetricsMaster metricsMaster) throws org.apache.zookeeper.KeeperException, IOException, UnsupportedOperationException Initialize a globally barriered procedure for master.- Parameters:
master
- Master service interface- Throws:
org.apache.zookeeper.KeeperException
IOException
UnsupportedOperationException
-
execProcedure
public void execProcedure(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) throws IOException Execute a distributed procedure on cluster- Parameters:
desc
- Procedure description- Throws:
IOException
-
execProcedureWithRet
public byte[] execProcedureWithRet(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) throws IOException Execute a distributed procedure on cluster with return data.- Parameters:
desc
- Procedure description- Returns:
- data returned from the procedure execution, null if no data
- Throws:
IOException
-
checkPermissions
public abstract void checkPermissions(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc, AccessChecker accessChecker, User user) throws IOException Check for required permissions before executing the procedure.- Throws:
IOException
- if permissions requirements are not met.
-
isProcedureDone
public abstract boolean isProcedureDone(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.ProcedureDescription desc) throws IOException Check if the procedure is finished successfully- Parameters:
desc
- Procedure description- Returns:
- true if the specified procedure is finished successfully
- Throws:
IOException
-