@InterfaceAudience.Private public class ReplicationQueuesZKImpl extends ReplicationStateZKBase implements ReplicationQueues
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
RS_LOCK_ZNODE
Name of znode we use to lock during failover
|
abortable, conf, DISABLED_ZNODE_BYTES, ENABLED_ZNODE_BYTES, hfileRefsZNode, ourClusterKey, peerStateNodeName, peersZNode, queuesZNode, replicationZNode, tableCFsNodeName, zookeeper, ZOOKEEPER_ZNODE_REPLICATION_HFILE_REFS_DEFAULT, ZOOKEEPER_ZNODE_REPLICATION_HFILE_REFS_KEY| 构造器和说明 |
|---|
ReplicationQueuesZKImpl(ZooKeeperWatcher zk,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
addHFileRefs(String peerId,
List<Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.Path>> pairs)
Add new hfile references to the queue.
|
void |
addLog(String queueId,
String filename)
Add a new WAL file to the given queue.
|
void |
addPeerToHFileRefs(String peerId)
Add a peer to hfile reference queue if peer does not exist.
|
boolean |
checkLockExists(String znode) |
Pair<String,SortedSet<String>> |
claimQueue(String regionserver,
String queueId)
Take ownership for the queue identified by queueId and belongs to a dead region server.
|
List<String> |
getAllQueues()
Get a list of all queues for this region server.
|
List<String> |
getListOfReplicators()
Get a list of all region servers that have outstanding replication queues.
|
String |
getLockZNode(String znode) |
long |
getLogPosition(String queueId,
String filename)
Get the current position for a specific WAL in a given queue.
|
List<String> |
getLogsInQueue(String queueId)
Get a list of all WALs in the given queue.
|
List<String> |
getUnClaimedQueueIds(String regionserver)
Get queueIds from a dead region server, whose queues has not been claimed by other region
servers.
|
void |
init(String serverName)
Initialize the region server replication queue interface.
|
boolean |
isThisOurRegionServer(String regionserver)
Checks if the provided znode is the same as this region server's
|
boolean |
isThisOurZnode(String znode)
Checks if the provided znode is the same as this region server's
|
boolean |
lockOtherRS(String znode)
Try to set a lock in another region server's znode.
|
void |
removeAllQueues()
Remove all replication queues for this region server.
|
void |
removeHFileRefs(String peerId,
List<String> files)
Remove hfile references from the queue.
|
void |
removeLog(String queueId,
String filename)
Remove an WAL file from the given queue.
|
void |
removePeerFromHFileRefs(String peerId)
Remove a peer from hfile reference queue.
|
void |
removeQueue(String queueId)
Remove a replication queue.
|
void |
removeReplicatorIfQueueIsEmpty(String regionserver)
Remove the znode of region server if the queue is empty.
|
void |
setLogPosition(String queueId,
String filename,
long position)
Set the current position for a specific WAL in a given queue.
|
getListOfReplicatorsZK, getPeerNode, getPeerStateNode, getTableCFsNode, isPeerPath, peerExists, toByteArraypublic ReplicationQueuesZKImpl(ZooKeeperWatcher zk, org.apache.hadoop.conf.Configuration conf, Abortable abortable)
public void init(String serverName) throws ReplicationException
ReplicationQueuesinit 在接口中 ReplicationQueuesserverName - The server name of the region server that owns the replication queues this
interface manages.ReplicationExceptionpublic List<String> getListOfReplicators() throws ReplicationException
ReplicationQueuesgetListOfReplicators 在接口中 ReplicationQueuesReplicationExceptionpublic void removeQueue(String queueId)
ReplicationQueuesremoveQueue 在接口中 ReplicationQueuesqueueId - a String that identifies the queue.public void addLog(String queueId, String filename) throws ReplicationException
ReplicationQueuesaddLog 在接口中 ReplicationQueuesqueueId - a String that identifies the queue.filename - name of the WALReplicationExceptionpublic void removeLog(String queueId, String filename)
ReplicationQueuesremoveLog 在接口中 ReplicationQueuesqueueId - a String that identifies the queue.filename - name of the WALpublic void setLogPosition(String queueId, String filename, long position)
ReplicationQueuessetLogPosition 在接口中 ReplicationQueuesqueueId - a String that identifies the queuefilename - name of the WALposition - the current position in the filepublic long getLogPosition(String queueId, String filename) throws ReplicationException
ReplicationQueuesgetLogPosition 在接口中 ReplicationQueuesqueueId - a String that identifies the queuefilename - name of the WALReplicationExceptionpublic boolean isThisOurZnode(String znode)
ReplicationQueuesisThisOurZnode 在接口中 ReplicationQueuesznode - to checkpublic void removeAllQueues()
ReplicationQueuesremoveAllQueues 在接口中 ReplicationQueuespublic List<String> getLogsInQueue(String queueId)
ReplicationQueuesgetLogsInQueue 在接口中 ReplicationQueuesqueueId - a String that identifies the queuepublic List<String> getAllQueues()
ReplicationQueuesgetAllQueues 在接口中 ReplicationQueuespublic boolean isThisOurRegionServer(String regionserver)
ReplicationQueuesisThisOurRegionServer 在接口中 ReplicationQueuesregionserver - the id of the region serverpublic List<String> getUnClaimedQueueIds(String regionserver)
ReplicationQueuesgetUnClaimedQueueIds 在接口中 ReplicationQueuespublic Pair<String,SortedSet<String>> claimQueue(String regionserver, String queueId)
ReplicationQueuesclaimQueue 在接口中 ReplicationQueuesregionserver - the id of the dead region serverqueueId - the id of the queuepublic void removeReplicatorIfQueueIsEmpty(String regionserver)
ReplicationQueuespublic boolean lockOtherRS(String znode)
znode - the server names of the other serverpublic boolean checkLockExists(String znode) throws org.apache.zookeeper.KeeperException
org.apache.zookeeper.KeeperExceptionpublic void addHFileRefs(String peerId, List<Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.Path>> pairs) throws ReplicationException
ReplicationQueuesaddHFileRefs 在接口中 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(String peerId, List<String> files)
ReplicationQueuesremoveHFileRefs 在接口中 ReplicationQueuespeerId - peer cluster id from which this hfile references needs to be removedfiles - list of hfile references to be removedpublic void addPeerToHFileRefs(String peerId) throws ReplicationException
ReplicationQueuesaddPeerToHFileRefs 在接口中 ReplicationQueuespeerId - peer cluster id to be addedReplicationException - if fails to add a peer id to hfile reference queuepublic void removePeerFromHFileRefs(String peerId)
ReplicationQueuesremovePeerFromHFileRefs 在接口中 ReplicationQueuespeerId - peer cluster id to be removedCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.