public class ReplicationSourceManager
extends java.lang.Object
| Constructor and Description |
|---|
ReplicationSourceManager(ReplicationQueues replicationQueues,
ReplicationPeers replicationPeers,
ReplicationTracker replicationTracker,
Configuration conf,
Server server,
FileSystem fs,
Path logDir,
Path oldLogDir,
java.util.UUID clusterId,
WALFileLengthProvider walFileLengthProvider)
Creates a replication manager and sets the watch on all the other registered region servers
|
| Modifier and Type | Method and Description |
|---|---|
void |
addHFileRefs(TableName tableName,
byte[] family,
java.util.List<<any>> pairs) |
void |
cleanOldLogs(java.lang.String key,
java.lang.String id,
boolean queueRecovered)
Cleans a log file and all older files from ZK.
|
void |
cleanUpHFileRefs(java.lang.String peerId,
java.util.List<java.lang.String> files) |
void |
closeQueue(ReplicationSourceInterface src)
Clear the references to the specified old source
|
void |
closeRecoveredQueue(ReplicationSourceInterface src)
Clear the references to the specified old source
|
void |
deleteSource(java.lang.String peerId,
boolean closeConnection)
Delete a complete queue of wals associated with a peer cluster
|
FileSystem |
getFs()
Get the handle on the local file system
|
Path |
getLogDir()
Get the directory where wals are stored by their RSs
|
Path |
getOldLogDir()
Get the directory where wals are archived
|
java.util.List<ReplicationSourceInterface> |
getOldSources()
Get a list of all the old sources of this rs
|
ReplicationPeers |
getReplicationPeers()
Get the ReplicationPeers used by this ReplicationSourceManager
|
ReplicationSourceInterface |
getSource(java.lang.String peerId)
Get the normal source for a given peer
|
java.util.List<ReplicationSourceInterface> |
getSources()
Get a list of all the normal sources of this rs
|
java.lang.String |
getStats()
Get a string representation of all the sources' metrics
|
java.util.concurrent.atomic.AtomicLong |
getTotalBufferUsed() |
void |
join()
Terminate the replication on this region server
|
void |
logPositionAndCleanOldLogs(Path log,
java.lang.String id,
long position,
boolean queueRecovered,
boolean holdLogInZK)
Provide the id of the peer and a log key and this method will figure which
wal it belongs to and will log, for this region server, the current
position.
|
void |
peerListChanged(java.util.List<java.lang.String> peerIds) |
void |
peerRemoved(java.lang.String peerId) |
void |
postLogRoll(Path newLog) |
void |
preLogRoll(Path newLog) |
void |
regionServerRemoved(java.lang.String regionserver) |
void |
removePeer(java.lang.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).
|
public ReplicationSourceManager(ReplicationQueues replicationQueues,
ReplicationPeers replicationPeers,
ReplicationTracker replicationTracker,
Configuration conf,
Server server,
FileSystem fs,
Path logDir,
Path oldLogDir,
java.util.UUID clusterId,
WALFileLengthProvider walFileLengthProvider)
throws java.io.IOException
replicationQueues - the interface for manipulating replication queuesreplicationPeers - replicationTracker - conf - the configuration to useserver - the server for this region serverfs - the file system to uselogDir - the directory that contains all wal directories of live RSsoldLogDir - the directory where old logs are archivedclusterId - java.io.IOExceptionpublic void logPositionAndCleanOldLogs(Path log,
java.lang.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 ZKpublic void cleanOldLogs(java.lang.String key,
java.lang.String id,
boolean queueRecovered)
key - Path to the logid - id of the peer clusterqueueRecovered - Whether this is a recovered queuepublic void deleteSource(java.lang.String peerId,
boolean closeConnection)
peerId - Id of the peer cluster queue of wals to deletepublic void join()
public java.util.List<ReplicationSourceInterface> getSources()
public java.util.List<ReplicationSourceInterface> getOldSources()
public ReplicationSourceInterface getSource(java.lang.String peerId)
peerId - public void preLogRoll(Path newLog)
throws java.io.IOException
java.io.IOExceptionpublic void postLogRoll(Path newLog)
throws java.io.IOException
java.io.IOExceptionpublic java.util.concurrent.atomic.AtomicLong getTotalBufferUsed()
public void closeRecoveredQueue(ReplicationSourceInterface src)
src - source to clearpublic void closeQueue(ReplicationSourceInterface src)
src - source to clearpublic void removePeer(java.lang.String id)
id - The id of the peer clusterpublic void regionServerRemoved(java.lang.String regionserver)
public void peerRemoved(java.lang.String peerId)
public void peerListChanged(java.util.List<java.lang.String> peerIds)
public Path getOldLogDir()
public Path getLogDir()
public FileSystem getFs()
public ReplicationPeers getReplicationPeers()
public java.lang.String getStats()
public void addHFileRefs(TableName tableName,
byte[] family,
java.util.List<<any>> pairs)
throws ReplicationException
ReplicationExceptionpublic void cleanUpHFileRefs(java.lang.String peerId,
java.util.List<java.lang.String> files)