org.apache.hadoop.hbase.procedure
Class ZKProcedureMemberRpcs

java.lang.Object
  extended by org.apache.hadoop.hbase.procedure.ZKProcedureMemberRpcs
All Implemented Interfaces:
Closeable, ProcedureMemberRpcs

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class ZKProcedureMemberRpcs
extends Object
implements ProcedureMemberRpcs

ZooKeeper based controller for a procedure member.

There can only be one ZKProcedureMemberRpcs per procedure type per member, since each procedure type is bound to a single set of znodes. You can have multiple ZKProcedureMemberRpcs on the same server, each serving a different member name, but each individual rpcs is still bound to a single member name (and since they are used to determine global progress, its important to not get this wrong).

To make this slightly more confusing, you can run multiple, concurrent procedures at the same time (as long as they have different types), from the same controller, but the same node name must be used for each procedure (though there is no conflict between the two procedure as long as they have distinct names).

There is no real error recovery with this mechanism currently -- if any the coordinator fails, its re-initialization will delete the znodes and require all in progress subprocedures to start anew.


Field Summary
protected  ProcedureMember member
           
 
Constructor Summary
ZKProcedureMemberRpcs(ZooKeeperWatcher watcher, String procType, String memberName)
          Must call start(ProcedureMember) before this can be used.
 
Method Summary
protected  void abort(String abortZNode)
          Pass along the found abort notification to the listener
 void close()
           
 String getMemberName()
          Each subprocedure is being executed on a member.
 ZKProcedureUtil getZkController()
           
 void sendMemberAborted(Subprocedure sub, ForeignException ee)
          This should be called by the member and should write a serialized root cause exception as to the abort znode.
 void sendMemberAcquired(Subprocedure sub)
          This attempts to create an acquired state znode for the procedure (snapshot name).
 void sendMemberCompleted(Subprocedure sub)
          This acts as the ack for a completed snapshot
 void start(ProcedureMember listener)
          Initialize and start any threads or connections the member needs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

member

protected ProcedureMember member
Constructor Detail

ZKProcedureMemberRpcs

public ZKProcedureMemberRpcs(ZooKeeperWatcher watcher,
                             String procType,
                             String memberName)
                      throws org.apache.zookeeper.KeeperException
Must call start(ProcedureMember) before this can be used.

Parameters:
watcher - ZooKeeperWatcher to be owned by this. Closed via close().
procType - name of the znode describing the procedure type
memberName - name of the member to join the procedure
Throws:
org.apache.zookeeper.KeeperException - if we can't reach zookeeper
Method Detail

getZkController

public ZKProcedureUtil getZkController()

getMemberName

public String getMemberName()
Description copied from interface: ProcedureMemberRpcs
Each subprocedure is being executed on a member. This is the identifier for the member.

Specified by:
getMemberName in interface ProcedureMemberRpcs
Returns:
the member name

sendMemberAcquired

public void sendMemberAcquired(Subprocedure sub)
                        throws IOException
This attempts to create an acquired state znode for the procedure (snapshot name). It then looks for the reached znode to trigger in-barrier execution. If not present we have a watcher, if present then trigger the in-barrier action.

Specified by:
sendMemberAcquired in interface ProcedureMemberRpcs
Parameters:
sub - the specified Subprocedure
Throws:
IOException - if we can't reach the coordinator

sendMemberCompleted

public void sendMemberCompleted(Subprocedure sub)
                         throws IOException
This acts as the ack for a completed snapshot

Specified by:
sendMemberCompleted in interface ProcedureMemberRpcs
Parameters:
sub - the specified Subprocedure
Throws:
IOException - if we can't reach the coordinator

sendMemberAborted

public void sendMemberAborted(Subprocedure sub,
                              ForeignException ee)
This should be called by the member and should write a serialized root cause exception as to the abort znode.

Specified by:
sendMemberAborted in interface ProcedureMemberRpcs
Parameters:
sub - the Subprocedure we are aborting
ee - the reason why the member's subprocedure aborted

abort

protected void abort(String abortZNode)
Pass along the found abort notification to the listener

Parameters:
abortZNode - full znode path to the failed procedure information

start

public void start(ProcedureMember listener)
Description copied from interface: ProcedureMemberRpcs
Initialize and start any threads or connections the member needs.

Specified by:
start in interface ProcedureMemberRpcs

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2013 The Apache Software Foundation. All Rights Reserved.