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
Modifier and TypeFieldDescriptionprivate final String
private org.apache.hadoop.conf.Configuration
private final org.apache.hadoop.fs.FileSystem
private final ConcurrentMap<String,
ReplicationPeerDescription> private ReplicationPeerStorage
private final ReplicationQueueStorage
private final ZKWatcher
-
Constructor Summary
ConstructorDescriptionReplicationPeerManager
(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 TypeMethodDescriptionvoid
addPeer
(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) private void
checkClusterKey
(String clusterKey) private void
checkConfiguredWALEntryFilters
(ReplicationPeerConfig peerConfig) private void
checkNamespacesAndTableCfsConfigConflict
(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 void
checkPeerConfig
(ReplicationPeerConfig peerConfig) private ReplicationPeerDescription
checkPeerExists
(String peerId) private void
checkQueuesDeleted
(String peerId) private void
checkSameClusterKey
(String clusterKey) static ReplicationPeerManager
create
(org.apache.hadoop.fs.FileSystem fs, ZKWatcher zk, org.apache.hadoop.conf.Configuration conf, String clusterId) void
disablePeer
(String peerId) void
enablePeer
(String peerId) getPeerConfig
(String peerId) boolean
getPeerState
(String peerId) getSerialPeerIdsBelongsTo
(TableName tableName) private boolean
isStringEquals
(String s1, String s2) For replication peer cluster key or endpoint class, null and empty string is same.void
onConfigurationChange
(org.apache.hadoop.conf.Configuration conf) This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.(package private) void
preAddPeer
(String peerId, ReplicationPeerConfig peerConfig) (package private) void
preDisablePeer
(String peerId) (package private) void
preEnablePeer
(String peerId) (package private) ReplicationPeerConfig
preRemovePeer
(String peerId) (package private) ReplicationPeerDescription
preUpdatePeerConfig
(String peerId, ReplicationPeerConfig peerConfig) Return the old peer description.(package private) void
removeAllLastPushedSeqIds
(String peerId) (package private) void
removeAllQueuesAndHFileRefs
(String peerId) void
removePeer
(String peerId) private void
setPeerState
(String peerId, boolean enabled) void
updatePeerConfig
(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:ConfigurationObserver
This method would be called by theConfigurationManager
object when theConfiguration
object is reloaded from disk.- Specified by:
onConfigurationChange
in interfaceConfigurationObserver
-