org.apache.hadoop.hbase.replication
Interface ReplicationQueues

All Known Implementing Classes:
ReplicationQueuesZKImpl

@InterfaceAudience.Private
public interface ReplicationQueues

This provides an interface for maintaining a region server's replication queues. These queues keep track of the HLogs that still need to be replicated to remote clusters.


Method Summary
 void addLog(String queueId, String filename)
          Add a new HLog file to the given queue.
 SortedMap<String,SortedSet<String>> claimQueues(String regionserver)
          Take ownership for the set of queues belonging 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 HLog in a given queue.
 List<String> getLogsInQueue(String queueId)
          Get a list of all HLogs in the given queue.
 void init(String serverName)
          Initialize the region server replication queue interface.
 boolean isThisOurZnode(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 removeLog(String queueId, String filename)
          Remove an HLog file from the given queue.
 void removeQueue(String queueId)
          Remove a replication queue.
 void setLogPosition(String queueId, String filename, long position)
          Set the current position for a specific HLog in a given queue.
 

Method Detail

init

void init(String serverName)
          throws ReplicationException
Initialize the region server replication queue interface.

Parameters:
serverName - The server name of the region server that owns the replication queues this interface manages.
Throws:
ReplicationException

removeQueue

void removeQueue(String queueId)
Remove a replication queue.

Parameters:
queueId - a String that identifies the queue.

addLog

void addLog(String queueId,
            String filename)
            throws ReplicationException
Add a new HLog file to the given queue. If the queue does not exist it is created.

Parameters:
queueId - a String that identifies the queue.
filename - name of the HLog
Throws:
ReplicationException

removeLog

void removeLog(String queueId,
               String filename)
Remove an HLog file from the given queue.

Parameters:
queueId - a String that identifies the queue.
filename - name of the HLog

setLogPosition

void setLogPosition(String queueId,
                    String filename,
                    long position)
Set the current position for a specific HLog in a given queue.

Parameters:
queueId - a String that identifies the queue
filename - name of the HLog
position - the current position in the file

getLogPosition

long getLogPosition(String queueId,
                    String filename)
                    throws ReplicationException
Get the current position for a specific HLog in a given queue.

Parameters:
queueId - a String that identifies the queue
filename - name of the HLog
Returns:
the current position in the file
Throws:
ReplicationException

removeAllQueues

void removeAllQueues()
Remove all replication queues for this region server.


getLogsInQueue

List<String> getLogsInQueue(String queueId)
Get a list of all HLogs in the given queue.

Parameters:
queueId - a String that identifies the queue
Returns:
a list of HLogs, null if this region server is dead and has no outstanding queues

getAllQueues

List<String> getAllQueues()
Get a list of all queues for this region server.

Returns:
a list of queueIds, null if this region server is dead and has no outstanding queues

claimQueues

SortedMap<String,SortedSet<String>> claimQueues(String regionserver)
Take ownership for the set of queues belonging to a dead region server.

Parameters:
regionserver - the id of the dead region server
Returns:
A SortedMap of the queues that have been claimed, including a SortedSet of HLogs in each queue. Returns an empty map if no queues were failed-over.

getListOfReplicators

List<String> getListOfReplicators()
Get a list of all region servers that have outstanding replication queues. These servers could be alive, dead or from a previous run of the cluster.

Returns:
a list of server names

isThisOurZnode

boolean isThisOurZnode(String znode)
Checks if the provided znode is the same as this region server's

Parameters:
znode - to check
Returns:
if this is this rs's znode


Copyright © 2007-2015 The Apache Software Foundation. All Rights Reserved.