@InterfaceAudience.Private public class ReplicationQueuesZKImpl extends ReplicationStateZKBase implements ReplicationQueues
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private String |
myQueuesZnode
Znode containing all replication queues for this region server.
|
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
Constructor and Description |
---|
ReplicationQueuesZKImpl(ReplicationQueuesArguments args) |
ReplicationQueuesZKImpl(ZKWatcher zk,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable) |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
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
|
private Pair<String,SortedSet<String>> |
moveQueueUsingMulti(String znode,
String peerId)
It "atomically" copies one peer's wals queue from another dead region server and returns them
all sorted.
|
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, toByteArray
private String myQueuesZnode
private static final org.slf4j.Logger LOG
public ReplicationQueuesZKImpl(ReplicationQueuesArguments args)
public ReplicationQueuesZKImpl(ZKWatcher zk, org.apache.hadoop.conf.Configuration conf, Abortable abortable)
public void init(String serverName) throws ReplicationException
ReplicationQueues
init
in interface ReplicationQueues
serverName
- The server name of the region server that owns the replication queues this
interface manages.ReplicationException
public List<String> getListOfReplicators() throws ReplicationException
ReplicationQueues
getListOfReplicators
in interface ReplicationQueues
ReplicationException
public void removeQueue(String queueId)
ReplicationQueues
removeQueue
in interface ReplicationQueues
queueId
- a String that identifies the queue.public void addLog(String queueId, String filename) throws ReplicationException
ReplicationQueues
addLog
in interface ReplicationQueues
queueId
- a String that identifies the queue.filename
- name of the WALReplicationException
public void removeLog(String queueId, String filename)
ReplicationQueues
removeLog
in interface ReplicationQueues
queueId
- a String that identifies the queue.filename
- name of the WALpublic void setLogPosition(String queueId, String filename, long position)
ReplicationQueues
setLogPosition
in interface ReplicationQueues
queueId
- a String that identifies the queuefilename
- name of the WALposition
- the current position in the filepublic long getLogPosition(String queueId, String filename) throws ReplicationException
ReplicationQueues
getLogPosition
in interface ReplicationQueues
queueId
- a String that identifies the queuefilename
- name of the WALReplicationException
public boolean isThisOurRegionServer(String regionserver)
ReplicationQueues
isThisOurRegionServer
in interface ReplicationQueues
regionserver
- the id of the region serverpublic List<String> getUnClaimedQueueIds(String regionserver)
ReplicationQueues
getUnClaimedQueueIds
in interface ReplicationQueues
public Pair<String,SortedSet<String>> claimQueue(String regionserver, String queueId)
ReplicationQueues
claimQueue
in interface ReplicationQueues
regionserver
- the id of the dead region serverqueueId
- the id of the queuepublic void removeReplicatorIfQueueIsEmpty(String regionserver)
ReplicationQueues
removeReplicatorIfQueueIsEmpty
in interface ReplicationQueues
public void removeAllQueues()
ReplicationQueues
removeAllQueues
in interface ReplicationQueues
public List<String> getLogsInQueue(String queueId)
ReplicationQueues
getLogsInQueue
in interface ReplicationQueues
queueId
- a String that identifies the queuepublic List<String> getAllQueues()
ReplicationQueues
getAllQueues
in interface ReplicationQueues
private Pair<String,SortedSet<String>> moveQueueUsingMulti(String znode, String peerId)
znode
- pertaining to the region server to copy the queues frompublic void addHFileRefs(String peerId, List<Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.Path>> pairs) throws ReplicationException
ReplicationQueues
addHFileRefs
in interface ReplicationQueues
peerId
- 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)
ReplicationQueues
removeHFileRefs
in interface ReplicationQueues
peerId
- 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
ReplicationQueues
addPeerToHFileRefs
in interface ReplicationQueues
peerId
- peer cluster id to be addedReplicationException
- if fails to add a peer id to hfile reference queuepublic void removePeerFromHFileRefs(String peerId)
ReplicationQueues
removePeerFromHFileRefs
in interface ReplicationQueues
peerId
- peer cluster id to be removedCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.