@InterfaceAudience.Private public class SyncReplicationWALProvider extends Object implements WALProvider, PeerActionListener
WALProvider for synchronous replication.
It works like an interceptor, when getting WAL, first it will check if the given region should be
replicated synchronously, if so it will return a special WAL for it, otherwise it will delegate
the request to the normal WALProvider.
WALProvider.AsyncWriter, WALProvider.Writer, WALProvider.WriterBase| Modifier and Type | Field and Description |
|---|---|
static String |
DUAL_WAL_IMPL |
DUMMY| Modifier and Type | Method and Description |
|---|---|
void |
addWALActionsListener(WALActionsListener listener)
Add a
WALActionsListener. |
void |
close()
shutdown utstanding WALs and clean up any persisted state.
|
long |
getLogFileSize()
Get size of the log files this provider is managing
|
long |
getNumLogFiles()
Get number of the log files this provider is managing
|
static Optional<String> |
getSyncReplicationPeerIdFromWALName(String name)
Returns the peer id if the wal file name is in the special group for a sync replication peer.
|
WAL |
getWAL(RegionInfo region) |
List<WAL> |
getWALs() |
void |
init(WALFactory factory,
org.apache.hadoop.conf.Configuration conf,
String providerId,
Abortable abortable)
Set up the provider to create wals.
|
void |
peerSyncReplicationStateChange(String peerId,
SyncReplicationState from,
SyncReplicationState to,
int stage) |
void |
setPeerInfoProvider(SyncReplicationPeerInfoProvider peerInfoProvider) |
void |
shutdown()
persist outstanding WALs to storage and stop accepting new appends.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetWALFileLengthProviderpublic static final String DUAL_WAL_IMPL
public void setPeerInfoProvider(SyncReplicationPeerInfoProvider peerInfoProvider)
public void init(WALFactory factory, org.apache.hadoop.conf.Configuration conf, String providerId, Abortable abortable) throws IOException
WALProviderinit in interface WALProviderfactory - factory that made us may not be nullconf - may not be nullproviderId - differentiate between providers from one factory. may be nullIOExceptionpublic WAL getWAL(RegionInfo region) throws IOException
getWAL in interface WALProviderregion - the region which we want to get a WAL for it. Could be null.IOExceptionpublic List<WAL> getWALs()
getWALs in interface WALProviderpublic void shutdown()
throws IOException
WALProvidershutdown in interface WALProviderIOExceptionpublic void close()
throws IOException
WALProviderclose in interface WALProviderIOExceptionpublic long getNumLogFiles()
WALProvidergetNumLogFiles in interface WALProviderpublic long getLogFileSize()
WALProvidergetLogFileSize in interface WALProviderpublic void addWALActionsListener(WALActionsListener listener)
WALProviderWALActionsListener.
Notice that you must call this method before calling WALProvider.getWAL(RegionInfo) as this method
will not effect the WAL which has already been created. And as long as we can only it
when initialization, it is not thread safe.
addWALActionsListener in interface WALProviderpublic void peerSyncReplicationStateChange(String peerId, SyncReplicationState from, SyncReplicationState to, int stage)
peerSyncReplicationStateChange in interface PeerActionListenerCopyright © 2007–2020 The Apache Software Foundation. All rights reserved.