@InterfaceAudience.Private public class TableReplicationQueueStorage extends Object implements ReplicationQueueStorage
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
HFILE_REF_FAMILY |
static byte[] |
LAST_SEQUENCE_ID_FAMILY |
static byte[] |
QUEUE_FAMILY |
| Constructor and Description |
|---|
TableReplicationQueueStorage(Connection conn,
TableName tableName) |
| 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 |
batchUpdateHFileRefs(String peerId,
List<String> hfileRefs)
Add the given hfile refs to the given peer.
|
void |
batchUpdateLastSequenceIds(List<ZKReplicationQueueStorageForMigration.ZkLastPushedSeqId> lastPushedSeqIds)
Update last pushed sequence id for the given regions and peers.
|
void |
batchUpdateQueues(ServerName serverName,
List<ReplicationQueueData> datas)
Update the replication queue datas for a given region server.
|
Map<String,ReplicationGroupOffset> |
claimQueue(ReplicationQueueId queueId,
ServerName targetServerName)
Change ownership for the queue identified by queueId and belongs to a dead region server.
|
Set<String> |
getAllHFileRefs()
Load all hfile references in all replication queues.
|
List<String> |
getAllPeersFromHFileRefsQueue()
Get list of all peers from hfile reference queue.
|
long |
getLastSequenceId(String encodedRegionName,
String peerId)
Read the max sequence id of the specific region for a given peer.
|
Map<String,ReplicationGroupOffset> |
getOffsets(ReplicationQueueId queueId)
Get the current offset of all the WAL groups for a queue
|
List<String> |
getReplicableHFiles(String peerId)
Get a list of all hfile references in the given peer.
|
boolean |
hasData()
Whether the replication queue table exists.
|
List<ReplicationQueueId> |
listAllQueueIds(ServerName serverName)
Get a list of all queues for the specific region server.
|
List<ReplicationQueueId> |
listAllQueueIds(String peerId)
Get a list of all queues for the specific peer.
|
List<ReplicationQueueId> |
listAllQueueIds(String peerId,
ServerName serverName)
Get a list of all queues for the specific region server and the specific peer
|
List<ReplicationQueueData> |
listAllQueues()
Get a list of all queues and the offsets.
|
List<ServerName> |
listAllReplicators()
Get a list of all region servers that have outstanding replication queues.
|
void |
removeAllQueues(String peerId)
Remove all the replication queues for the given peer.
|
void |
removeHFileRefs(String peerId,
List<String> files)
Remove hfile references from the queue.
|
void |
removeLastSequenceIds(String peerId)
Remove all the max sequence id record for the given peer.
|
void |
removeLastSequenceIds(String peerId,
List<String> encodedRegionNames)
Remove the max sequence id record for the given peer and regions.
|
void |
removeLastSequenceIdsAndHFileRefsBefore(long ts)
Remove all the last sequence ids and hfile references data which are written before the given
timestamp.
|
void |
removePeerFromHFileRefs(String peerId)
Remove a peer from hfile reference queue.
|
void |
removeQueue(ReplicationQueueId queueId)
Remove a replication queue
|
void |
setLastSequenceIds(String peerId,
Map<String,Long> lastSeqIds)
Set the max sequence id of a bunch of regions for a given peer.
|
void |
setOffset(ReplicationQueueId queueId,
String walGroup,
ReplicationGroupOffset offset,
Map<String,Long> lastSeqIds)
Set the current offset for a specific WAL group in a given queue.
|
public static final byte[] QUEUE_FAMILY
public static final byte[] LAST_SEQUENCE_ID_FAMILY
public static final byte[] HFILE_REF_FAMILY
public TableReplicationQueueStorage(Connection conn, TableName tableName)
public void setOffset(ReplicationQueueId queueId, String walGroup, ReplicationGroupOffset offset, Map<String,Long> lastSeqIds) throws ReplicationException
ReplicationQueueStoragesetOffset in interface ReplicationQueueStoragequeueId - the id of the queuewalGroup - the group of the WAL, can be empty if multi wal is not enabledoffset - the current offset of replication progresslastSeqIds - map with {encodedRegionName, sequenceId} pairs for serial replication.ReplicationExceptionpublic Map<String,ReplicationGroupOffset> getOffsets(ReplicationQueueId queueId) throws ReplicationException
ReplicationQueueStoragegetOffsets in interface ReplicationQueueStoragequeueId - the id of the queueReplicationExceptionpublic List<ReplicationQueueId> listAllQueueIds(String peerId) throws ReplicationException
ReplicationQueueStoragelistAllQueueIds in interface ReplicationQueueStoragepeerId - the id of the peerReplicationExceptionpublic List<ReplicationQueueId> listAllQueueIds(ServerName serverName) throws ReplicationException
ReplicationQueueStoragelistAllQueueIds in interface ReplicationQueueStorageserverName - the server name of the region server that owns the set of queuesReplicationExceptionpublic List<ReplicationQueueId> listAllQueueIds(String peerId, ServerName serverName) throws ReplicationException
ReplicationQueueStoragelistAllQueueIds in interface ReplicationQueueStoragepeerId - the id of the peerserverName - the server name of the region server that owns the set of queuesReplicationExceptionpublic List<ReplicationQueueData> listAllQueues() throws ReplicationException
ReplicationQueueStoragelistAllQueues in interface ReplicationQueueStorageReplicationExceptionpublic List<ServerName> listAllReplicators() throws ReplicationException
ReplicationQueueStoragelistAllReplicators in interface ReplicationQueueStorageReplicationExceptionpublic Map<String,ReplicationGroupOffset> claimQueue(ReplicationQueueId queueId, ServerName targetServerName) throws ReplicationException
ReplicationQueueStorageclaimQueue in interface ReplicationQueueStoragequeueId - the id of the queuetargetServerName - the name of the target region serverReplicationExceptionpublic void removeQueue(ReplicationQueueId queueId) throws ReplicationException
ReplicationQueueStorageremoveQueue in interface ReplicationQueueStoragequeueId - the id of the queue to removeReplicationExceptionpublic void removeAllQueues(String peerId) throws ReplicationException
ReplicationQueueStorageremoveAllQueues in interface ReplicationQueueStoragepeerId - the id of the peerReplicationExceptionpublic long getLastSequenceId(String encodedRegionName, String peerId) throws ReplicationException
ReplicationQueueStoragegetLastSequenceId in interface ReplicationQueueStorageencodedRegionName - the encoded region namepeerId - peer idReplicationExceptionpublic void setLastSequenceIds(String peerId, Map<String,Long> lastSeqIds) throws ReplicationException
ReplicationQueueStoragesetLastSequenceIds in interface ReplicationQueueStoragepeerId - peer idlastSeqIds - map with {encodedRegionName, sequenceId} pairs for serial replication.ReplicationExceptionpublic void removeLastSequenceIds(String peerId) throws ReplicationException
ReplicationQueueStorageremoveLastSequenceIds in interface ReplicationQueueStoragepeerId - peer idReplicationExceptionpublic void removeLastSequenceIds(String peerId, List<String> encodedRegionNames) throws ReplicationException
ReplicationQueueStorageremoveLastSequenceIds in interface ReplicationQueueStoragepeerId - peer idencodedRegionNames - the encoded region namesReplicationExceptionpublic void removePeerFromHFileRefs(String peerId) throws ReplicationException
ReplicationQueueStorageremovePeerFromHFileRefs in interface ReplicationQueueStoragepeerId - peer cluster id to be removedReplicationExceptionpublic void addHFileRefs(String peerId, List<Pair<org.apache.hadoop.fs.Path,org.apache.hadoop.fs.Path>> pairs) throws ReplicationException
ReplicationQueueStorageaddHFileRefs in interface ReplicationQueueStoragepeerId - 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) throws ReplicationException
ReplicationQueueStorageremoveHFileRefs in interface ReplicationQueueStoragepeerId - peer cluster id from which this hfile references needs to be removedfiles - list of hfile references to be removedReplicationExceptionpublic List<String> getAllPeersFromHFileRefsQueue() throws ReplicationException
ReplicationQueueStoragegetAllPeersFromHFileRefsQueue in interface ReplicationQueueStorageReplicationExceptionpublic List<String> getReplicableHFiles(String peerId) throws ReplicationException
ReplicationQueueStoragegetReplicableHFiles in interface ReplicationQueueStoragepeerId - a String that identifies the peerReplicationExceptionpublic Set<String> getAllHFileRefs() throws ReplicationException
ReplicationQueueStoragegetAllHFileRefs in interface ReplicationQueueStorageReplicationExceptionpublic boolean hasData()
throws ReplicationException
ReplicationQueueStoragehasData in interface ReplicationQueueStorageReplicationExceptionpublic void batchUpdateQueues(ServerName serverName, List<ReplicationQueueData> datas) throws ReplicationException
ReplicationQueueStoragebatchUpdateQueues in interface ReplicationQueueStorageReplicationExceptionpublic void batchUpdateLastSequenceIds(List<ZKReplicationQueueStorageForMigration.ZkLastPushedSeqId> lastPushedSeqIds) throws ReplicationException
ReplicationQueueStoragebatchUpdateLastSequenceIds in interface ReplicationQueueStorageReplicationExceptionpublic void batchUpdateHFileRefs(String peerId, List<String> hfileRefs) throws ReplicationException
ReplicationQueueStoragebatchUpdateHFileRefs in interface ReplicationQueueStorageReplicationExceptionpublic void removeLastSequenceIdsAndHFileRefsBefore(long ts)
throws ReplicationException
ReplicationQueueStorageremoveLastSequenceIdsAndHFileRefsBefore in interface ReplicationQueueStorageReplicationExceptionCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.