Class ReplicationPeerManager
java.lang.Object
org.apache.hadoop.hbase.master.replication.ReplicationPeerManager
- All Implemented Interfaces:
ConfigurationObserver
Manages and performs all replication admin operations.
Used to add/remove a replication peer.
Implement ConfigurationObserver mainly for recreating ReplicationPeerStorage, for
supporting migrating across different replication peer storages without restarting master.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate org.apache.hadoop.conf.Configurationprivate final org.apache.hadoop.fs.FileSystemprivate final ConcurrentMap<String,ReplicationPeerDescription> private ReplicationPeerStorageprivate final ReplicationQueueStorageprivate final ZKWatcher -
Constructor Summary
ConstructorsConstructorDescriptionReplicationPeerManager(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zk, ReplicationPeerStorage peerStorage, ReplicationQueueStorage queueStorage, ConcurrentMap<String, ReplicationPeerDescription> peers, org.apache.hadoop.conf.Configuration conf, String clusterId) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) private voidcheckClusterKey(String clusterKey) private voidcheckConfiguredWALEntryFilters(ReplicationPeerConfig peerConfig) private voidcheckNamespacesAndTableCfsConfigConflict(Set<String> namespaces, Map<TableName, ? extends Collection<String>> tableCfs) Set a namespace in the peer config means that all tables in this namespace will be replicated to the peer cluster.private voidcheckPeerConfig(ReplicationPeerConfig peerConfig) private ReplicationPeerDescriptioncheckPeerExists(String peerId) private voidcheckQueuesDeleted(String peerId) private voidcheckSameClusterKey(String clusterKey) static ReplicationPeerManagercreate(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zk, org.apache.hadoop.conf.Configuration conf, String clusterId) voiddisablePeer(String peerId) voidenablePeer(String peerId) getPeerConfig(String peerId) booleangetPeerState(String peerId) getSerialPeerIdsBelongsTo(TableName tableName) private booleanisStringEquals(String s1, String s2) For replication peer cluster key or endpoint class, null and empty string is same.voidonConfigurationChange(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.(package private) voidpreAddPeer(String peerId, ReplicationPeerConfig peerConfig) (package private) voidpreDisablePeer(String peerId) (package private) voidpreEnablePeer(String peerId) (package private) ReplicationPeerConfigpreRemovePeer(String peerId) (package private) ReplicationPeerDescriptionpreUpdatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) Return the old peer description.(package private) voidremoveAllLastPushedSeqIds(String peerId) (package private) voidremoveAllQueuesAndHFileRefs(String peerId) voidremovePeer(String peerId) private voidsetPeerState(String peerId, boolean enabled) voidupdatePeerConfig(String peerId, ReplicationPeerConfig peerConfig)
-
Field Details
-
peerStorage
-
queueStorage
-
peers
-
clusterId
-
conf
-
fs
-
zk
-
-
Constructor Details
-
ReplicationPeerManager
ReplicationPeerManager(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zk, ReplicationPeerStorage peerStorage, ReplicationQueueStorage queueStorage, ConcurrentMap<String, ReplicationPeerDescription> peers, org.apache.hadoop.conf.Configuration conf, String clusterId)
-
-
Method Details
-
checkQueuesDeleted
-
preAddPeer
void preAddPeer(String peerId, ReplicationPeerConfig peerConfig) throws DoNotRetryIOException, ReplicationException -
checkPeerExists
- Throws:
DoNotRetryIOException
-
preRemovePeer
- Throws:
DoNotRetryIOException
-
preEnablePeer
- Throws:
DoNotRetryIOException
-
preDisablePeer
- Throws:
DoNotRetryIOException
-
preUpdatePeerConfig
ReplicationPeerDescription preUpdatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws DoNotRetryIOException Return the old peer description. Can never be null.- Throws:
DoNotRetryIOException
-
addPeer
public void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) throws ReplicationException - Throws:
ReplicationException
-
removePeer
- Throws:
ReplicationException
-
setPeerState
- Throws:
ReplicationException
-
getPeerState
- Throws:
ReplicationException
-
enablePeer
- Throws:
ReplicationException
-
disablePeer
- Throws:
ReplicationException
-
updatePeerConfig
public void updatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException - Throws:
ReplicationException
-
listPeers
-
getPeerConfig
-
removeAllLastPushedSeqIds
- Throws:
ReplicationException
-
removeAllQueuesAndHFileRefs
- Throws:
ReplicationException
-
checkPeerConfig
- Throws:
DoNotRetryIOException
-
checkNamespacesAndTableCfsConfigConflict
private void checkNamespacesAndTableCfsConfigConflict(Set<String> namespaces, Map<TableName, ? extends Collection<String>> tableCfs) throws DoNotRetryIOExceptionSet a namespace in the peer config means that all tables in this namespace will be replicated to the peer cluster.- If peer config already has a namespace, then not allow set any table of this namespace to the peer config.
- If peer config already has a table, then not allow set this table's namespace to the peer config.
Set a exclude namespace in the peer config means that all tables in this namespace can't be replicated to the peer cluster.
- If peer config already has a exclude namespace, then not allow set any exclude table of this namespace to the peer config.
- If peer config already has a exclude table, then not allow set this table's namespace as a exclude namespace.
- Throws:
DoNotRetryIOException
-
checkConfiguredWALEntryFilters
private void checkConfiguredWALEntryFilters(ReplicationPeerConfig peerConfig) throws DoNotRetryIOException - Throws:
DoNotRetryIOException
-
checkClusterKey
- Throws:
DoNotRetryIOException
-
checkSameClusterKey
- Throws:
DoNotRetryIOException
-
getSerialPeerIdsBelongsTo
-
getQueueStorage
-
create
public static ReplicationPeerManager create(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zk, org.apache.hadoop.conf.Configuration conf, String clusterId) throws ReplicationException - Throws:
ReplicationException
-
isStringEquals
For replication peer cluster key or endpoint class, null and empty string is same. So here don't useStringUtils.equals(CharSequence, CharSequence)directly. -
onConfigurationChange
Description copied from interface:ConfigurationObserverThis method would be called by theConfigurationManagerobject when theConfigurationobject is reloaded from disk.- Specified by:
onConfigurationChangein interfaceConfigurationObserver
-