@InterfaceAudience.Private public class FSReplicationPeerStorage extends Object implements ReplicationPeerStorage
hbase
|
--peers
|
--<peer_id>
|
--peer_config
|
--disabled
|
--sync-rep-state
Notice that, if the peer is enabled, we will not have a disabled file.
And for other files, to avoid depending on atomic rename, we will use two files for storing the
content. When loading, we will try to read both the files and load the newer one. And when
writing, we will write to the older file.| Modifier and Type | Field and Description |
|---|---|
static String |
PEERS_DIR |
static String |
PEERS_DIR_DEFAULT |
| Constructor and Description |
|---|
FSReplicationPeerStorage(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.conf.Configuration conf) |
| Modifier and Type | Method and Description |
|---|---|
void |
addPeer(String peerId,
ReplicationPeerConfig peerConfig,
boolean enabled,
SyncReplicationState syncReplicationState)
Add a replication peer.
|
ReplicationPeerConfig |
getPeerConfig(String peerId)
Get the peer config of a replication peer.
|
SyncReplicationState |
getPeerNewSyncReplicationState(String peerId)
Get the new sync replication state.
|
SyncReplicationState |
getPeerSyncReplicationState(String peerId)
Get the sync replication state.
|
boolean |
isPeerEnabled(String peerId)
Test whether a replication peer is enabled.
|
List<String> |
listPeerIds()
Return the peer ids of all replication peers.
|
void |
removePeer(String peerId)
Remove a replication peer.
|
void |
setPeerNewSyncReplicationState(String peerId,
SyncReplicationState newState)
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 to ENABLED, otherwise to DISABLED. |
void |
transitPeerSyncReplicationState(String peerId)
Overwrite the sync replication state with the new sync replication state which is set with the
ReplicationPeerStorage.setPeerNewSyncReplicationState(String, SyncReplicationState) method above, and clear
the new sync replication state. |
void |
updatePeerConfig(String peerId,
ReplicationPeerConfig peerConfig)
Update the config a replication peer.
|
public static final String PEERS_DIR
public static final String PEERS_DIR_DEFAULT
public FSReplicationPeerStorage(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.conf.Configuration conf)
throws IOException
IOExceptionpublic void addPeer(String peerId, ReplicationPeerConfig peerConfig, boolean enabled, SyncReplicationState syncReplicationState) throws ReplicationException
ReplicationPeerStorageaddPeer in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void removePeer(String peerId) throws ReplicationException
ReplicationPeerStorageremovePeer in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void setPeerState(String peerId, boolean enabled) throws ReplicationException
ReplicationPeerStoragetrue to ENABLED, otherwise to DISABLED.setPeerState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void updatePeerConfig(String peerId, ReplicationPeerConfig peerConfig) throws ReplicationException
ReplicationPeerStorageupdatePeerConfig in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public List<String> listPeerIds() throws ReplicationException
ReplicationPeerStoragelistPeerIds in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public boolean isPeerEnabled(String peerId) throws ReplicationException
ReplicationPeerStorageisPeerEnabled in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public ReplicationPeerConfig getPeerConfig(String peerId) throws ReplicationException
ReplicationPeerStoragegetPeerConfig in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void setPeerNewSyncReplicationState(String peerId, SyncReplicationState newState) throws ReplicationException
ReplicationPeerStoragesetPeerNewSyncReplicationState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public void transitPeerSyncReplicationState(String peerId) throws ReplicationException
ReplicationPeerStorageReplicationPeerStorage.setPeerNewSyncReplicationState(String, SyncReplicationState) method above, and clear
the new sync replication state.transitPeerSyncReplicationState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public SyncReplicationState getPeerSyncReplicationState(String peerId) throws ReplicationException
ReplicationPeerStoragegetPeerSyncReplicationState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.public SyncReplicationState getPeerNewSyncReplicationState(String peerId) throws ReplicationException
ReplicationPeerStorageSyncReplicationState.NONE if we are not
in a transition.getPeerNewSyncReplicationState in interface ReplicationPeerStorageReplicationException - if there are errors accessing the storage service.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.