|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.replication.ReplicationStateZKBase
org.apache.hadoop.hbase.replication.ReplicationQueuesZKImpl
@InterfaceAudience.Private public class ReplicationQueuesZKImpl
This class provides an implementation of the ReplicationQueues interface using Zookeeper. The base znode that this class works at is the myQueuesZnode. The myQueuesZnode contains a list of all outstanding HLog files on this region server that need to be replicated. The myQueuesZnode is the regionserver name (a concatenation of the region server’s hostname, client port and start code). For example: /hbase/replication/rs/hostname.example.org,6020,1234 Within this znode, the region server maintains a set of HLog replication queues. These queues are represented by child znodes named using there give queue id. For example: /hbase/replication/rs/hostname.example.org,6020,1234/1 /hbase/replication/rs/hostname.example.org,6020,1234/2 Each queue has one child znode for every HLog that still needs to be replicated. The value of these HLog child znodes is the latest position that has been replicated. This position is updated every time a HLog entry is replicated. For example: /hbase/replication/rs/hostname.example.org,6020,1234/1/23522342.23422 [VALUE: 254]
Field Summary |
---|
Fields inherited from class org.apache.hadoop.hbase.replication.ReplicationStateZKBase |
---|
abortable, conf, DISABLED_ZNODE_BYTES, ENABLED_ZNODE_BYTES, ourClusterKey, peerStateNodeName, peersZNode, queuesZNode, replicationZNode, zookeeper |
Constructor Summary | |
---|---|
ReplicationQueuesZKImpl(ZooKeeperWatcher zk,
org.apache.hadoop.conf.Configuration conf,
Abortable abortable)
|
Method Summary | |
---|---|
void |
addLog(String queueId,
String filename)
Add a new HLog file to the given queue. |
SortedMap<String,SortedSet<String>> |
claimQueues(String regionserverZnode)
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. |
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. |
Methods inherited from class org.apache.hadoop.hbase.replication.ReplicationStateZKBase |
---|
getListOfReplicators, isPeerPath, peerExists, toByteArray |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.hadoop.hbase.replication.ReplicationQueues |
---|
getListOfReplicators |
Constructor Detail |
---|
public ReplicationQueuesZKImpl(ZooKeeperWatcher zk, org.apache.hadoop.conf.Configuration conf, Abortable abortable)
Method Detail |
---|
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 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 HLog
ReplicationException
public void removeLog(String queueId, String filename)
ReplicationQueues
removeLog
in interface ReplicationQueues
queueId
- a String that identifies the queue.filename
- name of the HLogpublic void setLogPosition(String queueId, String filename, long position)
ReplicationQueues
setLogPosition
in interface ReplicationQueues
queueId
- a String that identifies the queuefilename
- name of the HLogposition
- 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 HLog
ReplicationException
public boolean isThisOurZnode(String znode)
ReplicationQueues
isThisOurZnode
in interface ReplicationQueues
znode
- to check
public SortedMap<String,SortedSet<String>> claimQueues(String regionserverZnode)
ReplicationQueues
claimQueues
in interface ReplicationQueues
regionserverZnode
- the id of the dead region server
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 queue
public List<String> getAllQueues()
ReplicationQueues
getAllQueues
in interface ReplicationQueues
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |