@InterfaceAudience.Private public class ReplicationPeer extends Object implements Abortable, Closeable
Modifier and Type | Class and Description |
---|---|
class |
ReplicationPeer.PeerStateTracker
Tracker for state of this peer
|
class |
ReplicationPeer.TableCFsTracker
Tracker for (table, cf-list) map of this peer
|
Constructor and Description |
---|
ReplicationPeer(org.apache.hadoop.conf.Configuration conf,
String id)
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() |
String |
getClusterKey()
Get the cluster key of that peer
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Get the configuration object required to communicate with this peer
|
String |
getId()
Get the identifier of this peer
|
long |
getLastRegionserverUpdate()
Get the timestamp at which the last change occurred to the list of region servers to replicate
to.
|
AtomicBoolean |
getPeerEnabled()
Get the state of this peer
|
List<ServerName> |
getRegionServers()
Get a list of all the addresses of all the region servers
for this peer cluster
|
Map<String,List<String>> |
getTableCFs()
Get replicable (table, cf-list) map of this peer
|
ZooKeeperWatcher |
getZkw()
Get the ZK connection to 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
|
void |
reloadZkWatcher()
Closes the current ZKW (if not null) and creates a new one
|
void |
setRegionServers(List<ServerName> regionServers)
Set the list of region servers for that peer
|
void |
startStateTracker(ZooKeeperWatcher zookeeper,
String peerStateNode)
start a state tracker to check whether this peer is enabled or not
|
void |
startTableCFsTracker(ZooKeeperWatcher zookeeper,
String tableCFsNode)
start a table-cfs tracker to listen the (table, cf-list) map change
|
public ReplicationPeer(org.apache.hadoop.conf.Configuration conf, String id) throws ReplicationException
conf
- configuration object to this peerkey
- cluster key used to locate the peerid
- string representation of this peer's identifierReplicationException
public void startStateTracker(ZooKeeperWatcher zookeeper, String peerStateNode) throws org.apache.zookeeper.KeeperException
zookeeper
- zk watcher for the local clusterpeerStateNode
- path to zk node which stores peer stateorg.apache.zookeeper.KeeperException
public void startTableCFsTracker(ZooKeeperWatcher zookeeper, String tableCFsNode) throws org.apache.zookeeper.KeeperException
zookeeper
- zk watcher for the local clustertableCFsNode
- path to zk node which stores table-cfsorg.apache.zookeeper.KeeperException
public String getClusterKey()
public AtomicBoolean getPeerEnabled()
public Map<String,List<String>> getTableCFs()
public List<ServerName> getRegionServers()
public void setRegionServers(List<ServerName> regionServers)
regionServers
- list of addresses for the region serverspublic ZooKeeperWatcher getZkw()
public long getLastRegionserverUpdate()
public String getId()
public org.apache.hadoop.conf.Configuration getConfiguration()
public void abort(String why, Throwable e)
Abortable
public void reloadZkWatcher() throws IOException
IOException
- If anything goes wrong connectingpublic boolean isAborted()
Abortable
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public static boolean isStateEnabled(byte[] bytes) throws DeserializationException
bytes
- raw ZK databytes
are those of a pb serialized ENABLED state.DeserializationException
Copyright © 2014 The Apache Software Foundation. All Rights Reserved.