@InterfaceAudience.Private public class ReplicationPeerManager extends Object
Used to add/remove a replication peer.
Modifier and Type | Field and Description |
---|---|
private org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<SyncReplicationState,EnumSet<SyncReplicationState>> |
allowedTransition |
private String |
clusterId |
private org.apache.hadoop.conf.Configuration |
conf |
private static org.slf4j.Logger |
LOG |
private ConcurrentMap<String,ReplicationPeerDescription> |
peers |
private ReplicationPeerStorage |
peerStorage |
private ReplicationQueueStorage |
queueStorage |
private Semaphore |
syncReplicationPeerLock |
Constructor and Description |
---|
ReplicationPeerManager(ReplicationPeerStorage peerStorage,
ReplicationQueueStorage queueStorage,
ConcurrentMap<String,ReplicationPeerDescription> peers,
org.apache.hadoop.conf.Configuration conf,
String clusterId) |
private static final org.slf4j.Logger LOG
private final ReplicationPeerStorage peerStorage
private final ReplicationQueueStorage queueStorage
private final ConcurrentMap<String,ReplicationPeerDescription> peers
private final org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap<SyncReplicationState,EnumSet<SyncReplicationState>> allowedTransition
private final Semaphore syncReplicationPeerLock
private final org.apache.hadoop.conf.Configuration conf
ReplicationPeerManager(ReplicationPeerStorage peerStorage, ReplicationQueueStorage queueStorage, ConcurrentMap<String,ReplicationPeerDescription> peers, org.apache.hadoop.conf.Configuration conf, String clusterId)
private void checkQueuesDeleted(String peerId) throws ReplicationException, DoNotRetryIOException
void preAddPeer(String peerId, ReplicationPeerConfig peerConfig) throws DoNotRetryIOException, ReplicationException
private ReplicationPeerDescription checkPeerExists(String peerId) throws DoNotRetryIOException
DoNotRetryIOException
private void checkPeerInDAStateIfSyncReplication(String peerId) throws DoNotRetryIOException
DoNotRetryIOException
ReplicationPeerConfig preRemovePeer(String peerId) throws DoNotRetryIOException
DoNotRetryIOException
void preEnablePeer(String peerId) throws DoNotRetryIOException
DoNotRetryIOException
void preDisablePeer(String peerId) throws DoNotRetryIOException
DoNotRetryIOException
ReplicationPeerDescription preUpdatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws DoNotRetryIOException
DoNotRetryIOException
ReplicationPeerDescription preTransitPeerSyncReplicationState(String peerId, SyncReplicationState state) throws DoNotRetryIOException
DoNotRetryIOException
public void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled) throws ReplicationException
ReplicationException
public void removePeer(String peerId) throws ReplicationException
ReplicationException
private void setPeerState(String peerId, boolean enabled) throws ReplicationException
ReplicationException
public boolean getPeerState(String peerId) throws ReplicationException
ReplicationException
public void enablePeer(String peerId) throws ReplicationException
ReplicationException
public void disablePeer(String peerId) throws ReplicationException
ReplicationException
public void updatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException
ReplicationException
public List<ReplicationPeerDescription> listPeers(Pattern pattern)
public Optional<ReplicationPeerConfig> getPeerConfig(String peerId)
void removeAllLastPushedSeqIds(String peerId) throws ReplicationException
ReplicationException
public void setPeerNewSyncReplicationState(String peerId, SyncReplicationState state) throws ReplicationException
ReplicationException
public void transitPeerSyncReplicationState(String peerId, SyncReplicationState newState) throws ReplicationException
ReplicationException
public void removeAllQueues(String peerId) throws ReplicationException
ReplicationException
public void removeAllQueuesAndHFileRefs(String peerId) throws ReplicationException
ReplicationException
private void checkPeerConfig(ReplicationPeerConfig peerConfig) throws DoNotRetryIOException
DoNotRetryIOException
private void checkPeerConfigForSyncReplication(ReplicationPeerConfig peerConfig) throws DoNotRetryIOException
DoNotRetryIOException
private void checkSyncReplicationPeerConfigConflict(ReplicationPeerConfig peerConfig) throws DoNotRetryIOException
DoNotRetryIOException
private void checkNamespacesAndTableCfsConfigConflict(Set<String> namespaces, Map<TableName,? extends Collection<String>> tableCfs) throws DoNotRetryIOException
Set a exclude namespace in the peer config means that all tables in this namespace can't be replicated to the peer cluster.
DoNotRetryIOException
private void checkConfiguredWALEntryFilters(ReplicationPeerConfig peerConfig) throws DoNotRetryIOException
DoNotRetryIOException
private void checkClusterKey(String clusterKey) throws DoNotRetryIOException
DoNotRetryIOException
private void checkSameClusterKey(String clusterKey) throws DoNotRetryIOException
DoNotRetryIOException
public List<String> getSerialPeerIdsBelongsTo(TableName tableName)
public ReplicationQueueStorage getQueueStorage()
public static ReplicationPeerManager create(ZKWatcher zk, org.apache.hadoop.conf.Configuration conf, String clusterId) throws ReplicationException
ReplicationException
private boolean isStringEquals(String s1, String s2)
StringUtils.equals(CharSequence, CharSequence)
directly.public boolean tryAcquireSyncReplicationPeerLock()
public void releaseSyncReplicationPeerLock()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.