@InterfaceAudience.Private public class WALFactory extends Object
WALProvider
by class name.Modifier and Type | Class and Description |
---|---|
(package private) static class |
WALFactory.Providers
Maps between configuration names for providers and implementation classes.
|
Modifier and Type | Field and Description |
---|---|
(package private) Abortable |
abortable |
private org.apache.hadoop.conf.Configuration |
conf |
(package private) static String |
DEFAULT_WAL_PROVIDER |
private ExcludeDatanodeManager |
excludeDatanodeManager |
(package private) String |
factoryId |
private static org.slf4j.Logger |
LOG |
static String |
META_WAL_PROVIDER |
private LazyInitializedWALProvider |
metaProvider |
private WALProvider |
provider |
static String |
REPLICATION_WAL_PROVIDER |
(package private) static String |
REPLICATION_WAL_PROVIDER_ID |
private LazyInitializedWALProvider |
replicationProvider |
private static AtomicReference<WALFactory> |
singleton |
private static String |
SINGLETON_ID |
private int |
timeoutMillis
How long to attempt opening in-recovery wals
|
static String |
WAL_ENABLED |
static String |
WAL_PROVIDER |
static String |
WAL_STREAM_READER_CLASS_IMPL
Used in tests for injecting customized stream reader implementation, for example, inject fault
when reading, etc.
|
private Class<? extends WALStreamReader> |
walStreamReaderClass
Configuration-specified WAL Reader used when a custom reader is requested
|
Modifier | Constructor and Description |
---|---|
private |
WALFactory(org.apache.hadoop.conf.Configuration conf) |
|
WALFactory(org.apache.hadoop.conf.Configuration conf,
ServerName serverName,
Abortable abortable)
Create a WALFactory.
|
|
WALFactory(org.apache.hadoop.conf.Configuration conf,
String factoryId)
Create a WALFactory.
|
private |
WALFactory(org.apache.hadoop.conf.Configuration conf,
String factoryId,
Abortable abortable) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Shutdown all WALs and clean up any underlying storage.
|
(package private) static WALProvider |
createProvider(Class<? extends WALProvider> clazz) |
WALProvider.Writer |
createRecoveredEditsWriter(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Should be package-private, visible for recovery testing.
|
(package private) static WALProvider.Writer |
createRecoveredEditsWriter(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration configuration)
If you already have a WALFactory, you should favor the instance method.
|
WALStreamReader |
createStreamReader(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path) |
WALStreamReader |
createStreamReader(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
CancelableProgressable reporter)
Create a one-way stream reader for the WAL.
|
WALStreamReader |
createStreamReader(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
CancelableProgressable reporter,
long startPosition)
Create a one-way stream reader for the WAL, and start reading from the given
startPosition . |
static WALStreamReader |
createStreamReader(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf)
Create a one-way stream reader for a given path.
|
static WALStreamReader |
createStreamReader(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf,
long startPosition)
Create a one-way stream reader for a given path.
|
static WALTailingReader |
createTailingReader(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration conf,
long startPosition)
Create a tailing reader for the given path.
|
WALProvider.Writer |
createWALWriter(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
Create a writer for the WAL.
|
static WALProvider.Writer |
createWALWriter(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
org.apache.hadoop.conf.Configuration configuration)
If you already have a WALFactory, you should favor the instance method.
|
List<WALProvider> |
getAllWALProviders()
Returns all the wal providers, for example, the default one, the one for hbase:meta and the one
for hbase:replication.
|
org.apache.hadoop.conf.Configuration |
getConf() |
(package private) WALFactory.Providers |
getDefaultProvider() |
ExcludeDatanodeManager |
getExcludeDatanodeManager() |
String |
getFactoryId() |
static WALFactory |
getInstance(org.apache.hadoop.conf.Configuration configuration) |
(package private) WALProvider |
getMetaProvider() |
(package private) Class<? extends WALProvider> |
getProviderClass(String key,
String defaultValue) |
(package private) WALProvider |
getReplicationProvider() |
WAL |
getWAL(RegionInfo region) |
WALProvider |
getWALProvider() |
List<WAL> |
getWALs() |
void |
shutdown()
Tell the underlying WAL providers to shut down, but do not clean up underlying storage.
|
public static final String WAL_STREAM_READER_CLASS_IMPL
SecureWALCellCodec
to decode by check the
header of the WAL file, so we do not need to specify a specical reader to read the WAL file
either.
So typically you should not use this config in production.private static final org.slf4j.Logger LOG
public static final String WAL_PROVIDER
static final String DEFAULT_WAL_PROVIDER
public static final String META_WAL_PROVIDER
public static final String REPLICATION_WAL_PROVIDER
public static final String WAL_ENABLED
static final String REPLICATION_WAL_PROVIDER_ID
private final WALProvider provider
private final LazyInitializedWALProvider metaProvider
private final LazyInitializedWALProvider replicationProvider
private final Class<? extends WALStreamReader> walStreamReaderClass
private final int timeoutMillis
private final org.apache.hadoop.conf.Configuration conf
private final ExcludeDatanodeManager excludeDatanodeManager
private static final AtomicReference<WALFactory> singleton
private static final String SINGLETON_ID
private WALFactory(org.apache.hadoop.conf.Configuration conf)
public WALFactory(org.apache.hadoop.conf.Configuration conf, String factoryId) throws IOException
IOException
public WALFactory(org.apache.hadoop.conf.Configuration conf, ServerName serverName, Abortable abortable) throws IOException
factoryId
is the server name. We need this assumption in some places for
parsing the server name out from the wal file name.conf
- must not be null, will keep a reference to read params in later reader/writer
instances.serverName
- use to generate the factoryId, which will be append at the first of the final
file nameabortable
- the server associated with this WAL fileIOException
private WALFactory(org.apache.hadoop.conf.Configuration conf, String factoryId, Abortable abortable) throws IOException
conf
- must not be null, will keep a reference to read params in later reader/writer
instances.factoryId
- a unique identifier for this factory. used i.e. by filesystem implementations
to make a directoryabortable
- the server associated with this WAL fileIOException
WALFactory.Providers getDefaultProvider()
Class<? extends WALProvider> getProviderClass(String key, String defaultValue)
static WALProvider createProvider(Class<? extends WALProvider> clazz) throws IOException
IOException
public org.apache.hadoop.conf.Configuration getConf()
public void close() throws IOException
IOException
public void shutdown() throws IOException
IOException
WALProvider getMetaProvider() throws IOException
IOException
WALProvider getReplicationProvider() throws IOException
IOException
public WAL getWAL(RegionInfo region) throws IOException
region
- the region which we want to get a WAL for. Could be null.IOException
public WALStreamReader createStreamReader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws IOException
IOException
public WALStreamReader createStreamReader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, CancelableProgressable reporter) throws IOException
IOException
public WALStreamReader createStreamReader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, CancelableProgressable reporter, long startPosition) throws IOException
startPosition
.IOException
public WALProvider.Writer createWALWriter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws IOException
Should be package-private. public only for tests and
Compressor
IOException
public WALProvider.Writer createRecoveredEditsWriter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path) throws IOException
IOException
public static WALFactory getInstance(org.apache.hadoop.conf.Configuration configuration)
public static WALTailingReader createTailingReader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf, long startPosition) throws IOException
IOException
public static WALStreamReader createStreamReader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
public static WALStreamReader createStreamReader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration conf, long startPosition) throws IOException
IOException
static WALProvider.Writer createRecoveredEditsWriter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration configuration) throws IOException
IOException
public static WALProvider.Writer createWALWriter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, org.apache.hadoop.conf.Configuration configuration) throws IOException
IOException
public WALProvider getWALProvider()
public List<WALProvider> getAllWALProviders()
public ExcludeDatanodeManager getExcludeDatanodeManager()
public String getFactoryId()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.