@InterfaceAudience.Private public class TableBasedReplicationQueuesClientImpl extends Object implements ReplicationQueuesClient
| Modifier and Type | Field and Description |
|---|---|
protected Abortable |
abortable |
static byte[] |
CF_QUEUE |
static byte[] |
COL_QUEUE_OWNER |
static byte[] |
COL_QUEUE_OWNER_HISTORY |
protected org.apache.hadoop.conf.Configuration |
conf |
static String |
QUEUE_HISTORY_DELIMITER |
static TableName |
REPLICATION_TABLE_NAME
Name of the HBase Table used for tracking replication
|
static String |
ROW_KEY_DELIMITER |
| Constructor and Description |
|---|
TableBasedReplicationQueuesClientImpl(org.apache.hadoop.conf.Configuration conf,
Abortable abortable) |
TableBasedReplicationQueuesClientImpl(ReplicationQueuesClientArguments args) |
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildClaimedQueueHistory(String originalHistory,
String oldServer)
Creates a "|" delimited record of the queue's past region server owners.
|
protected String |
buildQueueRowKey(String serverName,
String queueId)
Build the row key for the given queueId.
|
List<String> |
getAllPeersFromHFileRefsQueue()
Get list of all peers from hfile reference queue.
|
List<String> |
getAllQueues(String serverName)
Get a list of all queues for the specified region server.
|
Set<String> |
getAllWALs()
Load all wals in all replication queues from ZK.
|
int |
getHFileRefsNodeChangeVersion()
Get the change version number of replication hfile references node.
|
boolean |
getInitializationStatus()
Get whether the Replication Table has been successfully initialized yet
|
List<String> |
getListOfReplicators()
Get a list of all region servers that have outstanding replication queues.
|
protected List<String> |
getLogsInQueue(byte[] rowKey) |
List<String> |
getLogsInQueue(String serverName,
String queueId)
Get a list of all WALs in the given queue on the given region server.
|
protected Table |
getOrBlockOnReplicationTable()
Attempts to acquire the Replication Table.
|
protected ResultScanner |
getQueuesBelongingToServer(String server)
Get the queue id's and meta data (Owner and History) for the queues belonging to the named
server
|
protected String |
getRawQueueIdFromRowKey(String rowKey)
Parse the original queueId from a row key
|
List<String> |
getReplicableHFiles(String peerId)
Get a list of all hfile references in the given peer.
|
void |
init()
Initialize the replication queue client interface.
|
protected byte[] |
queueIdToRowKey(String serverName,
String queueId)
Returns a queue's row key given either its raw or reclaimed queueId
|
protected List<String> |
readWALsFromResult(Result queue)
Read all of the WAL's from a queue into a list
|
public static final TableName REPLICATION_TABLE_NAME
public static final byte[] CF_QUEUE
public static final byte[] COL_QUEUE_OWNER
public static final byte[] COL_QUEUE_OWNER_HISTORY
public static final String ROW_KEY_DELIMITER
public static final String QUEUE_HISTORY_DELIMITER
protected final org.apache.hadoop.conf.Configuration conf
protected final Abortable abortable
public TableBasedReplicationQueuesClientImpl(ReplicationQueuesClientArguments args) throws IOException
IOExceptionpublic TableBasedReplicationQueuesClientImpl(org.apache.hadoop.conf.Configuration conf,
Abortable abortable)
throws IOException
IOExceptionpublic void init()
throws ReplicationException
ReplicationQueuesClientinit in interface ReplicationQueuesClientReplicationExceptionpublic List<String> getListOfReplicators()
getListOfReplicators in interface ReplicationQueuesClientpublic List<String> getLogsInQueue(String serverName, String queueId)
ReplicationQueuesClientgetLogsInQueue in interface ReplicationQueuesClientserverName - the server name of the region server that owns the queuequeueId - a String that identifies the queuepublic List<String> getAllQueues(String serverName)
ReplicationQueuesClientgetAllQueues in interface ReplicationQueuesClientserverName - the server name of the region server that owns the set of queuespublic Set<String> getAllWALs()
ReplicationQueuesClientgetAllWALs in interface ReplicationQueuesClientpublic int getHFileRefsNodeChangeVersion()
throws org.apache.zookeeper.KeeperException
ReplicationQueuesClientgetHFileRefsNodeChangeVersion in interface ReplicationQueuesClientorg.apache.zookeeper.KeeperExceptionpublic List<String> getAllPeersFromHFileRefsQueue() throws org.apache.zookeeper.KeeperException
ReplicationQueuesClientgetAllPeersFromHFileRefsQueue in interface ReplicationQueuesClientorg.apache.zookeeper.KeeperException - zookeeper exceptionpublic List<String> getReplicableHFiles(String peerId) throws org.apache.zookeeper.KeeperException
ReplicationQueuesClientgetReplicableHFiles in interface ReplicationQueuesClientpeerId - a String that identifies the peerorg.apache.zookeeper.KeeperException - zookeeper exceptionpublic boolean getInitializationStatus()
protected String buildQueueRowKey(String serverName, String queueId)
serverName - The owner of the queuequeueId - String identifier of the queueprotected String getRawQueueIdFromRowKey(String rowKey)
rowKey - String representation of a queue's row keyprotected byte[] queueIdToRowKey(String serverName, String queueId)
queueId - queueId of the queueprotected String buildClaimedQueueHistory(String originalHistory, String oldServer)
originalHistory - the queue's original owner historyoldServer - the name of the server that used to own the queueprotected List<String> readWALsFromResult(Result queue)
queue - HBase query result containing the queueprotected ResultScanner getQueuesBelongingToServer(String server) throws IOException
server - name of the serverIOExceptionprotected Table getOrBlockOnReplicationTable() throws IOException
IOExceptionCopyright © 2007–2017 The Apache Software Foundation. All rights reserved.