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
Nested ClassesModifier and TypeClassDescription(package private) static classstatic interfaceMap identifiers to a group number.(package private) static enumMaps 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
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<String,WALProvider> A group-provider mapping, make sure one-one rather than many-one mappingstatic final Stringstatic final Stringstatic final Stringdelegate provider for WAL creation/roll/close, but not support multiwalprivate WALFactoryprivate List<WALActionsListener>private static final org.slf4j.Loggerprivate static final Stringprivate Class<? extends WALProvider>private Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddWALActionsListener(WALActionsListener listener) Add aWALActionsListener.voidclose()shutdown utstanding WALs and clean up any persisted state.private WALProvidercreateProvider(String group) longGet size of the log files this provider is managinglongGet number of the log files this provider is managing(package private) RegionGroupingProvider.RegionGroupingStrategygetStrategy(org.apache.hadoop.conf.Configuration conf, String key, String defaultValue) instantiate a strategy from a config property.private WALgetWAL(RegionInfo region) getWALs()Returns the List of WALs that are used by this servervoidinit(WALFactory factory, org.apache.hadoop.conf.Configuration conf, String providerId, Abortable abortable) Set up the provider to create wals.voidshutdown()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, waitMethods 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:WALProviderSet up the provider to create wals. will only be called once per instance.- Specified by:
initin 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:WALProviderReturns the List of WALs that are used by this server- Specified by:
getWALsin interfaceWALProvider
-
getWAL
- Throws:
IOException
-
getWAL
- Specified by:
getWALin 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:WALProviderpersist 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:
shutdownin interfaceWALProvider- Throws:
IOException
-
close
Description copied from interface:WALProvidershutdown 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:
closein interfaceWALProvider- Throws:
IOException
-
getNumLogFiles
Description copied from interface:WALProviderGet number of the log files this provider is managing- Specified by:
getNumLogFilesin interfaceWALProvider
-
getLogFileSize
Description copied from interface:WALProviderGet size of the log files this provider is managing- Specified by:
getLogFileSizein interfaceWALProvider
-
addWALActionsListener
Description copied from interface:WALProviderAdd aWALActionsListener.Notice that you must call this method before calling
WALProvider.getWAL(RegionInfo)as this method will not effect theWALwhich has already been created. And as long as we can only it when initialization, it is not thread safe.- Specified by:
addWALActionsListenerin interfaceWALProvider
-