Package org.apache.hadoop.hbase.wal
Class RegionGroupingProvider
java.lang.Object
org.apache.hadoop.hbase.wal.RegionGroupingProvider
- All Implemented Interfaces:
WALProvider
A WAL Provider that returns a WAL per group of regions. This provider follows the decorator
pattern and mainly holds the logic for WAL grouping. WAL creation/roll/close is delegated to
DELEGATE_PROVIDER
Region grouping is handled via RegionGroupingProvider.RegionGroupingStrategy
and can
be configured via the property "hbase.wal.regiongrouping.strategy". Current strategy choices are
- defaultStrategy : Whatever strategy this version of HBase picks. currently "bounded".
- identity : each region belongs to its own group.
- bounded : bounded number of groups and region evenly assigned to each group.
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
static interface
Map identifiers to a group number.(package private) static enum
Maps between configuration names for strategies and implementation classes.Nested classes/interfaces inherited from interface org.apache.hadoop.hbase.wal.WALProvider
WALProvider.AsyncWriter, WALProvider.Writer, WALProvider.WriterBase
-
Field Summary
Modifier and TypeFieldDescriptionprivate final ConcurrentMap<String,
WALProvider> A group-provider mapping, make sure one-one rather than many-one mappingstatic final String
static final String
static final String
delegate provider for WAL creation/roll/close, but not support multiwalprivate WALFactory
private List<WALActionsListener>
private static final org.slf4j.Logger
private static final String
private Class<? extends WALProvider>
private String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addWALActionsListener
(WALActionsListener listener) Add aWALActionsListener
.void
close()
shutdown utstanding WALs and clean up any persisted state.private WALProvider
createProvider
(String group) long
Get size of the log files this provider is managinglong
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.private WAL
getWAL
(RegionInfo region) getWALs()
Returns the List of WALs that are used by this servervoid
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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.hadoop.hbase.wal.WALProvider
getWALFileLengthProvider
-
Field Details
-
LOG
-
REGION_GROUPING_STRATEGY
- See Also:
-
DEFAULT_REGION_GROUPING_STRATEGY
-
DELEGATE_PROVIDER
delegate provider for WAL creation/roll/close, but not support multiwal- See Also:
-
DEFAULT_DELEGATE_PROVIDER
-
META_WAL_GROUP_NAME
- See Also:
-
cached
A group-provider mapping, make sure one-one rather than many-one mapping -
createLock
-
strategy
-
factory
-
listeners
-
providerId
-
providerClass
-
-
Constructor Details
-
RegionGroupingProvider
public RegionGroupingProvider()
-
-
Method Details
-
getStrategy
RegionGroupingProvider.RegionGroupingStrategy getStrategy(org.apache.hadoop.conf.Configuration conf, String key, String defaultValue) throws IOException instantiate a strategy from a config property. requires conf to have already been set (as well as anything the provider might need to read).- Throws:
IOException
-
init
public void init(WALFactory factory, org.apache.hadoop.conf.Configuration conf, String providerId, Abortable abortable) throws IOException Description copied from interface:WALProvider
Set up the provider to create wals. will only be called once per instance.- Specified by:
init
in interfaceWALProvider
- Parameters:
factory
- factory that made us may not be nullconf
- may not be nullproviderId
- differentiate between providers from one factory. may be null- Throws:
IOException
-
createProvider
- Throws:
IOException
-
getWALs
Description copied from interface:WALProvider
Returns the List of WALs that are used by this server- Specified by:
getWALs
in interfaceWALProvider
-
getWAL
- Throws:
IOException
-
getWAL
- Specified by:
getWAL
in interfaceWALProvider
- Parameters:
region
- the region which we want to get a WAL for it. Could be null.- Returns:
- a WAL for writing entries for the given region.
- Throws:
IOException
-
shutdown
Description copied from interface:WALProvider
persist outstanding WALs to storage and stop accepting new appends. This method serves as shorthand for sending a sync to every WAL provided by a given implementation. Those WALs will also stop accepting new writes.- Specified by:
shutdown
in interfaceWALProvider
- Throws:
IOException
-
close
Description copied from interface:WALProvider
shutdown utstanding WALs and clean up any persisted state. Call this method only when you will not need to replay any of the edits to the WALs from this provider. After this call completes, the underlying resources should have been reclaimed.- Specified by:
close
in interfaceWALProvider
- Throws:
IOException
-
getNumLogFiles
Description copied from interface:WALProvider
Get number of the log files this provider is managing- Specified by:
getNumLogFiles
in interfaceWALProvider
-
getLogFileSize
Description copied from interface:WALProvider
Get size of the log files this provider is managing- Specified by:
getLogFileSize
in interfaceWALProvider
-
addWALActionsListener
Description copied from interface:WALProvider
Add aWALActionsListener
.Notice that you must call this method before calling
WALProvider.getWAL(RegionInfo)
as this method will not effect theWAL
which has already been created. And as long as we can only it when initialization, it is not thread safe.- Specified by:
addWALActionsListener
in interfaceWALProvider
-