Class ZKProcedureCoordinator
java.lang.Object
org.apache.hadoop.hbase.procedure.ZKProcedureCoordinator
- All Implemented Interfaces:
Closeable,AutoCloseable,ProcedureCoordinatorRpcs
ZooKeeper based
ProcedureCoordinatorRpcs for a ProcedureCoordinator-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ProcedureCoordinator(package private) Stringprivate static final org.slf4j.Logger(package private) String(package private) ZKWatcherprivate ZKProcedureUtil -
Constructor Summary
ConstructorsConstructorDescriptionZKProcedureCoordinator(ZKWatcher watcher, String procedureClass, String coordName) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidReceive a notification and propagate it to the local coordinatorfinal voidclose()(package private) final ZKProcedureUtilUsed in testingfinal voidresetMembers(Procedure proc) Delete znodes that are no longer in use.final voidsendAbortToMembers(Procedure proc, ForeignException ee) This is the abort message being sent by the coordinator to member TODO this code isn't actually used but can be used to issue a cancellation from the coordinator.final voidsendGlobalBarrierAcquire(Procedure proc, byte[] info, List<String> nodeNames) The "acquire" phase.voidsendGlobalBarrierReached(Procedure proc, List<String> nodeNames) Notify members that all members have acquired their parts of the barrier and that they can now execute under the global barrier.final booleanstart(ProcedureCoordinator coordinator) Start monitoring znodes in ZK - subclass hook to start monitoring znodes they are about.
-
Field Details
-
LOG
-
zkProc
-
coordinator
-
watcher
-
procedureType
-
coordName
-
-
Constructor Details
-
ZKProcedureCoordinator
- Parameters:
watcher- zookeeper watcher. Owned by this and closed viaclose()procedureClass- procedure type name is a category for when there are multiple kinds of procedures.-- this becomes a znode so be aware of the naming restrictionscoordName- name of the node running the coordinator- Throws:
org.apache.zookeeper.KeeperException- if an unexpected zk error occurs
-
-
Method Details
-
sendGlobalBarrierAcquire
public final void sendGlobalBarrierAcquire(Procedure proc, byte[] info, List<String> nodeNames) throws IOException, IllegalArgumentException The "acquire" phase. The coordinator creates a new procType/acquired/ znode dir. If znodes appear, first acquire to relevant listener or sets watch waiting for notification of the acquire node- Specified by:
sendGlobalBarrierAcquirein interfaceProcedureCoordinatorRpcs- Parameters:
proc- the Procedureinfo- data to be stored in the acquire nodenodeNames- children of the acquire phase- Throws:
IOException- if any failure occurs.IllegalArgumentException- if the procedure was already marked as failed
-
sendGlobalBarrierReached
Description copied from interface:ProcedureCoordinatorRpcsNotify members that all members have acquired their parts of the barrier and that they can now execute under the global barrier. Must come after callingProcedureCoordinatorRpcs.sendGlobalBarrierAcquire(Procedure, byte[], List)- Specified by:
sendGlobalBarrierReachedin interfaceProcedureCoordinatorRpcs- Parameters:
proc- name of the procedure to startnodeNames- members to tell we have reached in-barrier phase- Throws:
IOException- if we can't reach the remote notification mechanism
-
resetMembers
Delete znodes that are no longer in use.- Specified by:
resetMembersin interfaceProcedureCoordinatorRpcs- Parameters:
proc- name of the procedure to reset- Throws:
IOException- if the remote notification mechanism cannot be reached
-
start
Start monitoring znodes in ZK - subclass hook to start monitoring znodes they are about.- Specified by:
startin interfaceProcedureCoordinatorRpcs- Returns:
- true if succeed, false if encountered initialization errors.
-
sendAbortToMembers
This is the abort message being sent by the coordinator to member TODO this code isn't actually used but can be used to issue a cancellation from the coordinator.- Specified by:
sendAbortToMembersin interfaceProcedureCoordinatorRpcs- Parameters:
proc- name of the procedure that was abortedee- the reason why the procedure needs to be aborted
-
abort
Receive a notification and propagate it to the local coordinator- Parameters:
abortNode- full znode path to the failed procedure information
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getZkProcedureUtil
Used in testing
-