@InterfaceAudience.Private public class RegionGroupingProvider extends Object implements WALProvider
DELEGATE_PROVIDER
Region grouping is handled via RegionGroupingProvider.RegionGroupingStrategy
and can
be configured via the property "hbase.wal.regiongrouping.strategy". Current strategy choices are
Modifier and Type | Class and Description |
---|---|
(package private) static class |
RegionGroupingProvider.IdentityGroupingStrategy |
static interface |
RegionGroupingProvider.RegionGroupingStrategy
Map identifiers to a group number.
|
(package private) static class |
RegionGroupingProvider.Strategies
Maps between configuration names for strategies and implementation classes.
|
WALProvider.AsyncWriter, WALProvider.Writer, WALProvider.WriterBase
Modifier and Type | Field and Description |
---|---|
private ConcurrentMap<String,WALProvider> |
cached
A group-provider mapping, make sure one-one rather than many-one mapping
|
private KeyLocker<String> |
createLock |
static String |
DEFAULT_DELEGATE_PROVIDER |
static String |
DEFAULT_REGION_GROUPING_STRATEGY |
static String |
DELEGATE_PROVIDER
delegate provider for WAL creation/roll/close, but not support multiwal
|
private WALFactory |
factory |
private List<WALActionsListener> |
listeners |
private static org.slf4j.Logger |
LOG |
private static String |
META_WAL_GROUP_NAME |
private Class<? extends WALProvider> |
providerClass |
private String |
providerId |
static String |
REGION_GROUPING_STRATEGY |
private RegionGroupingProvider.RegionGroupingStrategy |
strategy |
Constructor and Description |
---|
RegionGroupingProvider() |
Modifier and Type | Method and Description |
---|---|
void |
addWALActionsListener(WALActionsListener listener)
Add a
WALActionsListener . |
void |
close()
shutdown utstanding WALs and clean up any persisted state.
|
private WALProvider |
createProvider(String group) |
long |
getLogFileSize()
Get size of the log files this provider is managing
|
long |
getNumLogFiles()
Get number of the log files this provider is managing
|
(package private) RegionGroupingProvider.RegionGroupingStrategy |
getStrategy(org.apache.hadoop.conf.Configuration conf,
String key,
String defaultValue)
instantiate a strategy from a config property.
|
WAL |
getWAL(RegionInfo region) |
private WAL |
getWAL(String group) |
List<WAL> |
getWALs()
Returns the List of WALs that are used by this server
|
void |
init(WALFactory factory,
org.apache.hadoop.conf.Configuration conf,
String providerId,
Abortable abortable)
Set up the provider to create wals.
|
void |
shutdown()
persist outstanding WALs to storage and stop accepting new appends.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWALFileLengthProvider
private static final org.slf4j.Logger LOG
public static final String REGION_GROUPING_STRATEGY
public static final String DEFAULT_REGION_GROUPING_STRATEGY
public static final String DELEGATE_PROVIDER
public static final String DEFAULT_DELEGATE_PROVIDER
private static final String META_WAL_GROUP_NAME
private final ConcurrentMap<String,WALProvider> cached
private final KeyLocker<String> createLock
private RegionGroupingProvider.RegionGroupingStrategy strategy
private WALFactory factory
private List<WALActionsListener> listeners
private String providerId
private Class<? extends WALProvider> providerClass
public RegionGroupingProvider()
RegionGroupingProvider.RegionGroupingStrategy getStrategy(org.apache.hadoop.conf.Configuration conf, String key, String defaultValue) throws IOException
IOException
public void init(WALFactory factory, org.apache.hadoop.conf.Configuration conf, String providerId, Abortable abortable) throws IOException
WALProvider
init
in interface WALProvider
factory
- factory that made us may not be nullconf
- may not be nullproviderId
- differentiate between providers from one factory. may be nullIOException
private WALProvider createProvider(String group) throws IOException
IOException
public List<WAL> getWALs()
WALProvider
getWALs
in interface WALProvider
private WAL getWAL(String group) throws IOException
IOException
public WAL getWAL(RegionInfo region) throws IOException
getWAL
in interface WALProvider
region
- the region which we want to get a WAL for it. Could be null.IOException
public void shutdown() throws IOException
WALProvider
shutdown
in interface WALProvider
IOException
public void close() throws IOException
WALProvider
close
in interface WALProvider
IOException
public long getNumLogFiles()
WALProvider
getNumLogFiles
in interface WALProvider
public long getLogFileSize()
WALProvider
getLogFileSize
in interface WALProvider
public void addWALActionsListener(WALActionsListener listener)
WALProvider
WALActionsListener
.
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 WALProvider
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.