Class ZKReplicationPeerStorage
java.lang.Object
org.apache.hadoop.hbase.replication.ZKReplicationStorageBase
org.apache.hadoop.hbase.replication.ZKReplicationPeerStorage
- All Implemented Interfaces:
ReplicationPeerStorage
@Private
public class ZKReplicationPeerStorage
extends ZKReplicationStorageBase
implements ReplicationPeerStorage
ZK based replication peer storage.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final byte[]
static final byte[]
static final String
static final byte[]
static final String
static final String
static final String
static final String
private final String
The name of the znode that contains the replication status of a remote slave (i.e.private final String
The name of the znode that contains a list of all remote slave (i.e.static final String
Fields inherited from class org.apache.hadoop.hbase.replication.ZKReplicationStorageBase
conf, REPLICATION_ZNODE, REPLICATION_ZNODE_DEFAULT, replicationZNode, zookeeper
-
Constructor Summary
ConstructorDescriptionZKReplicationPeerStorage
(ZKWatcher zookeeper, org.apache.hadoop.conf.Configuration conf) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPeer
(String peerId, ReplicationPeerConfig peerConfig, boolean enabled, SyncReplicationState syncReplicationState) Add a replication peer.getNewSyncReplicationStateNode
(String peerId) getPeerConfig
(String peerId) Get the peer config of a replication peer.getPeerNewSyncReplicationState
(String peerId) Get the new sync replication state.getPeerNode
(String peerId) getPeerStateNode
(String peerId) getPeerSyncReplicationState
(String peerId) Get the sync replication state.private SyncReplicationState
getSyncReplicationState
(String peerId, String path) getSyncReplicationStateNode
(String peerId) boolean
isPeerEnabled
(String peerId) Test whether a replication peer is enabled.Return the peer ids of all replication peers.void
removePeer
(String peerId) Remove a replication peer.void
setPeerNewSyncReplicationState
(String peerId, SyncReplicationState state) Set the new sync replication state that we are going to transit to.void
setPeerState
(String peerId, boolean enabled) Set the state of peer,true
toENABLED
, otherwise toDISABLED
.void
Overwrite the sync replication state with the new sync replication state which is set with theReplicationPeerStorage.setPeerNewSyncReplicationState(String, SyncReplicationState)
method above, and clear the new sync replication state.void
updatePeerConfig
(String peerId, ReplicationPeerConfig peerConfig) Update the config a replication peer.Methods inherited from class org.apache.hadoop.hbase.replication.ZKReplicationStorageBase
toByteArray
-
Field Details
-
PEERS_ZNODE
- See Also:
-
PEERS_ZNODE_DEFAULT
- See Also:
-
PEERS_STATE_ZNODE
- See Also:
-
PEERS_STATE_ZNODE_DEFAULT
- See Also:
-
ENABLED_ZNODE_BYTES
-
DISABLED_ZNODE_BYTES
-
SYNC_REPLICATION_STATE_ZNODE
- See Also:
-
NEW_SYNC_REPLICATION_STATE_ZNODE
- See Also:
-
NONE_STATE_ZNODE_BYTES
-
peerStateNodeName
The name of the znode that contains the replication status of a remote slave (i.e. peer) cluster. -
peersZNode
The name of the znode that contains a list of all remote slave (i.e. peer) clusters.
-
-
Constructor Details
-
ZKReplicationPeerStorage
-
-
Method Details
-
getPeerStateNode
-
getPeerNode
-
getSyncReplicationStateNode
-
getNewSyncReplicationStateNode
-
addPeer
public void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled, SyncReplicationState syncReplicationState) throws ReplicationException Description copied from interface:ReplicationPeerStorage
Add a replication peer.- Specified by:
addPeer
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
removePeer
Description copied from interface:ReplicationPeerStorage
Remove a replication peer.- Specified by:
removePeer
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
setPeerState
Description copied from interface:ReplicationPeerStorage
Set the state of peer,true
toENABLED
, otherwise toDISABLED
.- Specified by:
setPeerState
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
updatePeerConfig
public void updatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException Description copied from interface:ReplicationPeerStorage
Update the config a replication peer.- Specified by:
updatePeerConfig
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
listPeerIds
Description copied from interface:ReplicationPeerStorage
Return the peer ids of all replication peers.- Specified by:
listPeerIds
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
isPeerEnabled
Description copied from interface:ReplicationPeerStorage
Test whether a replication peer is enabled.- Specified by:
isPeerEnabled
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
getPeerConfig
Description copied from interface:ReplicationPeerStorage
Get the peer config of a replication peer.- Specified by:
getPeerConfig
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
setPeerNewSyncReplicationState
public void setPeerNewSyncReplicationState(String peerId, SyncReplicationState state) throws ReplicationException Description copied from interface:ReplicationPeerStorage
Set the new sync replication state that we are going to transit to.- Specified by:
setPeerNewSyncReplicationState
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
transitPeerSyncReplicationState
Description copied from interface:ReplicationPeerStorage
Overwrite the sync replication state with the new sync replication state which is set with theReplicationPeerStorage.setPeerNewSyncReplicationState(String, SyncReplicationState)
method above, and clear the new sync replication state.- Specified by:
transitPeerSyncReplicationState
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
getSyncReplicationState
private SyncReplicationState getSyncReplicationState(String peerId, String path) throws ReplicationException - Throws:
ReplicationException
-
getPeerNewSyncReplicationState
public SyncReplicationState getPeerNewSyncReplicationState(String peerId) throws ReplicationException Description copied from interface:ReplicationPeerStorage
Get the new sync replication state. Will returnSyncReplicationState.NONE
if we are not in a transition.- Specified by:
getPeerNewSyncReplicationState
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-
getPeerSyncReplicationState
Description copied from interface:ReplicationPeerStorage
Get the sync replication state.- Specified by:
getPeerSyncReplicationState
in interfaceReplicationPeerStorage
- Throws:
ReplicationException
- if there are errors accessing the storage service.
-