@InterfaceAudience.Private public class ReplicationPeers extends Object implements ConfigurationObserver
We implement ConfigurationObserver
mainly for recreating the
ReplicationPeerStorage
, so we can change the ReplicationPeerStorage
without
restarting the region server.
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private org.apache.hadoop.fs.FileSystem |
fs |
private static org.slf4j.Logger |
LOG |
private ConcurrentMap<String,ReplicationPeerImpl> |
peerCache |
private ReplicationPeerStorage |
peerStorage |
private ZKWatcher |
zookeeper |
Constructor and Description |
---|
ReplicationPeers(org.apache.hadoop.fs.FileSystem fs,
ZKWatcher zookeeper,
org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
boolean |
addPeer(String peerId)
Method called after a peer has been connected.
|
private ReplicationPeerImpl |
createPeer(String peerId)
Helper method to connect to a peer
|
Set<String> |
getAllPeerIds()
Returns the set of peerIds of the clusters that have been connected and have an underlying
ReplicationPeer.
|
org.apache.hadoop.conf.Configuration |
getConf() |
ReplicationPeerImpl |
getPeer(String peerId)
Returns the ReplicationPeerImpl for the specified cached peer.
|
Map<String,ReplicationPeerImpl> |
getPeerCache() |
ReplicationPeerStorage |
getPeerStorage() |
void |
init() |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
This method would be called by the
ConfigurationManager object when the
Configuration object is reloaded from disk. |
ReplicationPeerConfig |
refreshPeerConfig(String peerId) |
SyncReplicationState |
refreshPeerNewSyncReplicationState(String peerId) |
ReplicationPeer.PeerState |
refreshPeerState(String peerId) |
ReplicationPeerImpl |
removePeer(String peerId) |
void |
transitPeerSyncReplicationState(String peerId) |
private static final org.slf4j.Logger LOG
private volatile org.apache.hadoop.conf.Configuration conf
private final ConcurrentMap<String,ReplicationPeerImpl> peerCache
private final org.apache.hadoop.fs.FileSystem fs
private volatile ReplicationPeerStorage peerStorage
ReplicationPeers(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zookeeper, org.apache.hadoop.conf.Configuration conf)
public org.apache.hadoop.conf.Configuration getConf()
public void init() throws ReplicationException
ReplicationException
public ReplicationPeerStorage getPeerStorage()
public boolean addPeer(String peerId) throws ReplicationException
peerId
- a short that identifies the clusterReplicationException
- if connecting to the peer failspublic ReplicationPeerImpl removePeer(String peerId)
public ReplicationPeerImpl getPeer(String peerId)
peerId
- id for the peerpublic Set<String> getAllPeerIds()
public Map<String,ReplicationPeerImpl> getPeerCache()
public ReplicationPeer.PeerState refreshPeerState(String peerId) throws ReplicationException
ReplicationException
public ReplicationPeerConfig refreshPeerConfig(String peerId) throws ReplicationException
ReplicationException
public SyncReplicationState refreshPeerNewSyncReplicationState(String peerId) throws ReplicationException
ReplicationException
public void transitPeerSyncReplicationState(String peerId)
private ReplicationPeerImpl createPeer(String peerId) throws ReplicationException
peerId
- peer's identifierReplicationException
public void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
ConfigurationObserver
ConfigurationManager
object when the
Configuration
object is reloaded from disk.onConfigurationChange
in interface ConfigurationObserver
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.