@InterfaceAudience.Private public class ReplicationPeerZKImpl extends ReplicationStateZKBase implements ReplicationPeer, Abortable, Closeable
| Modifier and Type | Class and Description |
|---|---|
class |
ReplicationPeerZKImpl.PeerConfigTracker
Tracker for PeerConfigNode of this peer
|
class |
ReplicationPeerZKImpl.PeerStateTracker
Tracker for state of this peer
|
ReplicationPeer.PeerState| Modifier and Type | Field and Description |
|---|---|
private org.apache.hadoop.conf.Configuration |
conf |
private String |
id |
private static org.slf4j.Logger |
LOG |
private ReplicationPeerConfig |
peerConfig |
private ReplicationPeerZKImpl.PeerConfigTracker |
peerConfigTracker |
private ReplicationPeer.PeerState |
peerState |
private ReplicationPeerZKImpl.PeerStateTracker |
peerStateTracker |
private Map<TableName,List<String>> |
tableCFs |
abortable, DISABLED_ZNODE_BYTES, ENABLED_ZNODE_BYTES, hfileRefsZNode, ourClusterKey, peerStateNodeName, peersZNode, queuesZNode, replicationZNode, tableCFsNodeName, zookeeper, ZOOKEEPER_ZNODE_REPLICATION_HFILE_REFS_DEFAULT, ZOOKEEPER_ZNODE_REPLICATION_HFILE_REFS_KEY| Constructor and Description |
|---|
ReplicationPeerZKImpl(ZKWatcher zkWatcher,
org.apache.hadoop.conf.Configuration conf,
String id,
ReplicationPeerConfig peerConfig,
Abortable abortable)
Constructor that takes all the objects required to communicate with the specified peer, except
for the region server addresses.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort(String why,
Throwable e)
Abort the server or client.
|
void |
close() |
private boolean |
ensurePeerEnabled(String path)
Utility method to ensure an ENABLED znode is in place; if not present, we create it.
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Get the configuration object required to communicate with this peer
|
String |
getId()
Get the identifier of this peer
|
Set<String> |
getNamespaces()
Get replicable namespace set of this peer
|
long |
getPeerBandwidth()
Get the per node bandwidth upper limit for this peer
|
ReplicationPeerConfig |
getPeerConfig()
Get the peer config object
|
ReplicationPeer.PeerState |
getPeerState()
Returns the state of the peer
|
Map<TableName,List<String>> |
getTableCFs()
Get replicable (table, cf-list) map of this peer
|
boolean |
isAborted()
Check if the server or client was aborted.
|
static boolean |
isStateEnabled(byte[] bytes)
Parse the raw data from ZK to get a peer's state
|
private static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationState.State |
parseStateFrom(byte[] bytes) |
private ReplicationPeerConfig |
readPeerConfig() |
private void |
readPeerStateZnode() |
void |
startPeerConfigTracker(String peerConfigNode)
start a table-cfs tracker to listen the (table, cf-list) map change
|
void |
startStateTracker(String peerStateNode)
start a state tracker to check whether this peer is enabled or not
|
void |
trackPeerConfigChanges(ReplicationPeerConfigListener listener) |
getListOfReplicatorsZK, getPeerNode, getPeerStateNode, getTableCFsNode, isPeerPath, peerExists, toByteArrayprivate static final org.slf4j.Logger LOG
private ReplicationPeerConfig peerConfig
private volatile ReplicationPeer.PeerState peerState
private final org.apache.hadoop.conf.Configuration conf
private ReplicationPeerZKImpl.PeerStateTracker peerStateTracker
private ReplicationPeerZKImpl.PeerConfigTracker peerConfigTracker
public ReplicationPeerZKImpl(ZKWatcher zkWatcher, org.apache.hadoop.conf.Configuration conf, String id, ReplicationPeerConfig peerConfig, Abortable abortable) throws ReplicationException
conf - configuration object to this peerid - string representation of this peer's identifierpeerConfig - configuration for the replication peerReplicationExceptionpublic void startStateTracker(String peerStateNode) throws org.apache.zookeeper.KeeperException
peerStateNode - path to zk node which stores peer stateorg.apache.zookeeper.KeeperExceptionprivate void readPeerStateZnode() throws DeserializationException
DeserializationExceptionpublic void startPeerConfigTracker(String peerConfigNode) throws org.apache.zookeeper.KeeperException
peerConfigNode - path to zk node which stores table-cfsorg.apache.zookeeper.KeeperExceptionprivate ReplicationPeerConfig readPeerConfig()
public ReplicationPeer.PeerState getPeerState()
ReplicationPeergetPeerState in interface ReplicationPeerpublic String getId()
getId in interface ReplicationPeerpublic ReplicationPeerConfig getPeerConfig()
getPeerConfig in interface ReplicationPeerpublic org.apache.hadoop.conf.Configuration getConfiguration()
getConfiguration in interface ReplicationPeerpublic Map<TableName,List<String>> getTableCFs()
getTableCFs in interface ReplicationPeerpublic Set<String> getNamespaces()
getNamespaces in interface ReplicationPeerpublic long getPeerBandwidth()
ReplicationPeergetPeerBandwidth in interface ReplicationPeerpublic void trackPeerConfigChanges(ReplicationPeerConfigListener listener)
trackPeerConfigChanges in interface ReplicationPeerpublic void abort(String why, Throwable e)
Abortablepublic boolean isAborted()
Abortablepublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic static boolean isStateEnabled(byte[] bytes) throws DeserializationException
bytes - raw ZK databytes are those of a pb serialized ENABLED state.DeserializationExceptionprivate static org.apache.hadoop.hbase.shaded.protobuf.generated.ReplicationProtos.ReplicationState.State parseStateFrom(byte[] bytes) throws DeserializationException
bytes - Content of a state znode.DeserializationExceptionprivate boolean ensurePeerEnabled(String path) throws org.apache.zookeeper.KeeperException.NodeExistsException, org.apache.zookeeper.KeeperException
path - Path to znode to checkorg.apache.zookeeper.KeeperException.NodeExistsExceptionorg.apache.zookeeper.KeeperExceptionCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.