@InterfaceAudience.Private public class ReplicationQueuesZKImpl extends ReplicationStateZKBase implements ReplicationQueues
abortable, conf, DISABLED_ZNODE_BYTES, ENABLED_ZNODE_BYTES, hfileRefsZNode, ourClusterKey, peerStateNodeName, peersZNode, queuesZNode, replicationForBulkLoadEnabled, replicationZNode, zookeeper, ZOOKEEPER_ZNODE_REPLICATION_HFILE_REFS_DEFAULT, ZOOKEEPER_ZNODE_REPLICATION_HFILE_REFS_KEY| Constructor and Description |
|---|
ReplicationQueuesZKImpl(ZooKeeperWatcher zk,
Configuration conf,
Abortable abortable) |
| Modifier and Type | Method and Description |
|---|---|
void |
addHFileRefs(java.lang.String peerId,
java.util.List<Pair<Path,Path>> pairs)
Add new hfile references to the queue.
|
void |
addLog(java.lang.String queueId,
java.lang.String filename)
Add a new WAL file to the given queue.
|
void |
addPeerToHFileRefs(java.lang.String peerId)
Add a peer to hfile reference queue if peer does not exist.
|
java.util.SortedMap<java.lang.String,java.util.SortedSet<java.lang.String>> |
claimQueues(java.lang.String regionserverZnode)
Take ownership for the set of queues belonging to a dead region server.
|
java.util.List<java.lang.String> |
getAllQueues()
Get a list of all queues for this region server.
|
long |
getLogPosition(java.lang.String queueId,
java.lang.String filename)
Get the current position for a specific WAL in a given queue.
|
java.util.List<java.lang.String> |
getLogsInQueue(java.lang.String queueId)
Get a list of all WALs in the given queue.
|
void |
init(java.lang.String serverName)
Initialize the region server replication queue interface.
|
boolean |
isThisOurZnode(java.lang.String znode)
Checks if the provided znode is the same as this region server's
|
void |
removeAllQueues()
Remove all replication queues for this region server.
|
void |
removeHFileRefs(java.lang.String peerId,
java.util.List<java.lang.String> files)
Remove hfile references from the queue.
|
void |
removeLog(java.lang.String queueId,
java.lang.String filename)
Remove an WAL file from the given queue.
|
void |
removeQueue(java.lang.String queueId)
Remove a replication queue.
|
void |
setLogPosition(java.lang.String queueId,
java.lang.String filename,
long position)
Set the current position for a specific WAL in a given queue.
|
getListOfReplicators, isPeerPath, peerExists, toByteArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetListOfReplicatorspublic ReplicationQueuesZKImpl(ZooKeeperWatcher zk, Configuration conf, Abortable abortable)
public void init(java.lang.String serverName)
throws ReplicationException
ReplicationQueuesinit in interface ReplicationQueuesserverName - The server name of the region server that owns the replication queues this
interface manages.ReplicationExceptionpublic void removeQueue(java.lang.String queueId)
ReplicationQueuesremoveQueue in interface ReplicationQueuesqueueId - a String that identifies the queue.public void addLog(java.lang.String queueId,
java.lang.String filename)
throws ReplicationException
ReplicationQueuesaddLog in interface ReplicationQueuesqueueId - a String that identifies the queue.filename - name of the WALReplicationExceptionpublic void removeLog(java.lang.String queueId,
java.lang.String filename)
ReplicationQueuesremoveLog in interface ReplicationQueuesqueueId - a String that identifies the queue.filename - name of the WALpublic void setLogPosition(java.lang.String queueId,
java.lang.String filename,
long position)
ReplicationQueuessetLogPosition in interface ReplicationQueuesqueueId - a String that identifies the queuefilename - name of the WALposition - the current position in the filepublic long getLogPosition(java.lang.String queueId,
java.lang.String filename)
throws ReplicationException
ReplicationQueuesgetLogPosition in interface ReplicationQueuesqueueId - a String that identifies the queuefilename - name of the WALReplicationExceptionpublic boolean isThisOurZnode(java.lang.String znode)
ReplicationQueuesisThisOurZnode in interface ReplicationQueuesznode - to checkpublic java.util.SortedMap<java.lang.String,java.util.SortedSet<java.lang.String>> claimQueues(java.lang.String regionserverZnode)
ReplicationQueuesclaimQueues in interface ReplicationQueuesregionserverZnode - the id of the dead region serverpublic void removeAllQueues()
ReplicationQueuesremoveAllQueues in interface ReplicationQueuespublic java.util.List<java.lang.String> getLogsInQueue(java.lang.String queueId)
ReplicationQueuesgetLogsInQueue in interface ReplicationQueuesqueueId - a String that identifies the queuepublic java.util.List<java.lang.String> getAllQueues()
ReplicationQueuesgetAllQueues in interface ReplicationQueuespublic void addHFileRefs(java.lang.String peerId,
java.util.List<Pair<Path,Path>> pairs)
throws ReplicationException
ReplicationQueuesaddHFileRefs in interface ReplicationQueuespeerId - peer cluster id to which the hfiles need to be replicatedpairs - list of pairs of { HFile location in staging dir, HFile path in region dir which
will be added in the queue }ReplicationException - if fails to add a hfile referencepublic void removeHFileRefs(java.lang.String peerId,
java.util.List<java.lang.String> files)
ReplicationQueuesremoveHFileRefs in interface ReplicationQueuespeerId - peer cluster id from which this hfile references needs to be removedfiles - list of hfile references to be removedpublic void addPeerToHFileRefs(java.lang.String peerId)
throws ReplicationException
ReplicationQueuesaddPeerToHFileRefs in interface ReplicationQueuespeerId - peer cluster id to be addedReplicationException - if fails to add a peer id to hfile reference queue