|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager
@InterfaceAudience.Private public class ReplicationSourceManager
This class is responsible to manage all the replication sources. There are two classes of sources:
| Constructor Summary | |
|---|---|
ReplicationSourceManager(ReplicationQueues replicationQueues,
ReplicationPeers replicationPeers,
ReplicationTracker replicationTracker,
org.apache.hadoop.conf.Configuration conf,
Stoppable stopper,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path logDir,
org.apache.hadoop.fs.Path oldLogDir,
UUID clusterId)
Creates a replication manager and sets the watch on all the other registered region servers |
|
| Method Summary | |
|---|---|
ReplicationSourceInterface |
addSource(String id)
Add a new normal source to this region server |
void |
cleanOldLogs(String key,
String id,
boolean queueRecovered)
Cleans a log file and all older files from ZK. |
void |
closeRecoveredQueue(ReplicationSourceInterface src)
Clear the references to the specified old source |
void |
deleteSource(String peerId,
boolean closeConnection)
Delete a complete queue of hlogs associated with a peer cluster |
org.apache.hadoop.fs.FileSystem |
getFs()
Get the handle on the local file system |
protected Map<String,SortedSet<String>> |
getHLogs()
Get a copy of the hlogs of the first source on this rs |
org.apache.hadoop.fs.Path |
getLogDir()
Get the directory where hlogs are stored by their RSs |
org.apache.hadoop.fs.Path |
getOldLogDir()
Get the directory where hlogs are archived |
ReplicationSourceInterface |
getReplicationSource(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
ReplicationSourceManager manager,
ReplicationQueues replicationQueues,
ReplicationPeers replicationPeers,
Stoppable stopper,
String peerId,
UUID clusterId)
Factory method to create a replication source |
List<ReplicationSourceInterface> |
getSources()
Get a list of all the normal sources of this rs |
String |
getStats()
Get a string representation of all the sources' metrics |
void |
init()
Adds a normal source per registered peer cluster and tries to process all old region server hlog queues |
void |
join()
Terminate the replication on this region server |
void |
logPositionAndCleanOldLogs(org.apache.hadoop.fs.Path log,
String id,
long position,
boolean queueRecovered,
boolean holdLogInZK)
Provide the id of the peer and a log key and this method will figure which hlog it belongs to and will log, for this region server, the current position. |
void |
peerListChanged(List<String> peerIds)
The list of registered peer clusters has changed. |
void |
peerRemoved(String peerId)
A peer cluster has been removed (i.e. |
void |
regionServerRemoved(String regionserver)
A region server has been removed from the local cluster |
void |
removePeer(String id)
Thie method first deletes all the recovered sources for the specified id, then deletes the normal source (deleting all related data in ZK). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReplicationSourceManager(ReplicationQueues replicationQueues,
ReplicationPeers replicationPeers,
ReplicationTracker replicationTracker,
org.apache.hadoop.conf.Configuration conf,
Stoppable stopper,
org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path logDir,
org.apache.hadoop.fs.Path oldLogDir,
UUID clusterId)
replicationQueues - the interface for manipulating replication queuesreplicationPeers - replicationTracker - conf - the configuration to usestopper - the stopper object for this region serverfs - the file system to uselogDir - the directory that contains all hlog directories of live RSsoldLogDir - the directory where old logs are archivedclusterId - | Method Detail |
|---|
public void logPositionAndCleanOldLogs(org.apache.hadoop.fs.Path log,
String id,
long position,
boolean queueRecovered,
boolean holdLogInZK)
log - Path to the log currently being replicated from
replication status in zookeeper. It will also delete older entries.id - id of the peer clusterposition - current location in the logqueueRecovered - indicates if this queue comes from another region serverholdLogInZK - if true then the log is retained in ZK
public void cleanOldLogs(String key,
String id,
boolean queueRecovered)
key - Path to the logid - id of the peer clusterqueueRecovered - Whether this is a recovered queue
public void init()
throws IOException
IOException
public ReplicationSourceInterface addSource(String id)
throws IOException
id - the id of the peer cluster
IOException
public void deleteSource(String peerId,
boolean closeConnection)
peerId - Id of the peer cluster queue of hlogs to deletepublic void join()
protected Map<String,SortedSet<String>> getHLogs()
public List<ReplicationSourceInterface> getSources()
public ReplicationSourceInterface getReplicationSource(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem fs,
ReplicationSourceManager manager,
ReplicationQueues replicationQueues,
ReplicationPeers replicationPeers,
Stoppable stopper,
String peerId,
UUID clusterId)
throws IOException
conf - the configuration to usefs - the file system to usemanager - the manager to usestopper - the stopper object for this region serverpeerId - the id of the peer cluster
IOExceptionpublic void closeRecoveredQueue(ReplicationSourceInterface src)
src - source to clearpublic void removePeer(String id)
id - The id of the peer clusterpublic void regionServerRemoved(String regionserver)
ReplicationListener
regionServerRemoved in interface ReplicationListenerregionserver - the removed region serverpublic void peerRemoved(String peerId)
ReplicationListener
peerRemoved in interface ReplicationListenerpeerId - The peer id of the cluster that has been removedpublic void peerListChanged(List<String> peerIds)
ReplicationListener
peerListChanged in interface ReplicationListenerpeerIds - A list of all currently registered peer clusterspublic org.apache.hadoop.fs.Path getOldLogDir()
public org.apache.hadoop.fs.Path getLogDir()
public org.apache.hadoop.fs.FileSystem getFs()
public String getStats()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||