Package org.apache.hadoop.hbase.wal
Class WALSplitter
java.lang.Object
org.apache.hadoop.hbase.wal.WALSplitter
Split RegionServer WAL files. Splits the WAL into new files, one per region, to be picked up on
Region reopen. Deletes the split WAL when finished. Create an instance and call
splitWAL(FileStatus, CancelableProgressable)
per file or use static helper methods.-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
static class
Contains some methods to control WAL-entries producer / consumer interactions(package private) static final class
Data structure returned as result by #splitWAL(FileStatus, CancelableProgressable). -
Field Summary
Modifier and TypeFieldDescriptionprivate final long
protected final org.apache.hadoop.conf.Configuration
static final boolean
private EntryBuffers
private org.apache.hadoop.fs.FileStatus
private final boolean
private static final org.slf4j.Logger
private final int
(package private) OutputSink
(package private) final org.apache.hadoop.fs.Path
(package private) final org.apache.hadoop.fs.FileSystem
(package private) final RegionServerServices
protected final LastSequenceId
private final boolean
static final boolean
By default we retry errors in splitting, rather than skipping.static final String
static final String
static final String
static final String
True if we are to run with bounded amount of writers rather than let the count blossom.private SplitLogWorkerCoordination
Coordinator for split log.private final boolean
private final String
static final String
Split WAL directly to hfiles instead of into intermediary 'recovered.edits' files.private final WALFactory
protected final org.apache.hadoop.fs.FileSystem
protected final org.apache.hadoop.fs.Path
-
Constructor Summary
ConstructorDescriptionWALSplitter
(WALFactory factory, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path walRootDir, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem rootFS) WALSplitter
(WALFactory factory, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path walRootDir, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem rootFS, LastSequenceId idChecker, SplitLogWorkerCoordination splitLogWorkerCoordination, RegionServerServices rsServices) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Setup the output sinks and entry buffers ahead of splitting WAL.protected WALProvider.Writer
createWriter
(org.apache.hadoop.fs.Path logfile) Create a newWALProvider.Writer
for writing log splits.(package private) org.apache.hadoop.fs.FileStatus
private WAL.Entry
getNextLogLine
(WALStreamReader in, org.apache.hadoop.fs.Path path, boolean skipErrors) private int
Get current open writersprotected WALStreamReader
getReader
(org.apache.hadoop.fs.FileStatus walStatus, boolean skipErrors, CancelableProgressable cancel) Create a newWALStreamReader
for reading logs to split.private WALStreamReader
getReader
(org.apache.hadoop.fs.Path curLogFile, CancelableProgressable reporter) Create a newWALStreamReader
for reading logs to split.(package private) String
(package private) WALFactory
private boolean
isRegionDirPresentUnderRoot
(TableName tn, String region) static List<org.apache.hadoop.fs.Path>
split
(org.apache.hadoop.fs.Path walRootDir, org.apache.hadoop.fs.Path walsDir, org.apache.hadoop.fs.Path archiveDir, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.conf.Configuration conf, WALFactory factory) Split a folder of WAL files.static boolean
splitLogFile
(org.apache.hadoop.fs.Path walDir, org.apache.hadoop.fs.FileStatus logfile, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.conf.Configuration conf, CancelableProgressable reporter, LastSequenceId idChecker, SplitLogWorkerCoordination splitLogWorkerCoordination, WALFactory factory, RegionServerServices rsServices) Splits a WAL file.(package private) WALSplitter.SplitWALResult
splitWAL
(org.apache.hadoop.fs.FileStatus walStatus, CancelableProgressable cancel) WAL splitting implementation, splits one WAL file.
-
Field Details
-
LOG
-
SPLIT_SKIP_ERRORS_KEY
- See Also:
-
SPLIT_SKIP_ERRORS_DEFAULT
By default we retry errors in splitting, rather than skipping.- See Also:
-
walRootDir
-
walFS
-
conf
-
rootDir
-
rootFS
-
rsServices
-
outputSink
-
entryBuffers
-
splitLogWorkerCoordination
Coordinator for split log. Used by the zk-based log splitter. Not used by the procedure v2-based log splitter. -
walFactory
-
sequenceIdChecker
-
lastFlushedSequenceIds
-
regionMaxSeqIdInStores
-
fileBeingSplit
-
tmpDirName
-
WAL_SPLIT_TO_HFILE
Split WAL directly to hfiles instead of into intermediary 'recovered.edits' files.- See Also:
-
DEFAULT_WAL_SPLIT_TO_HFILE
- See Also:
-
SPLIT_WRITER_CREATION_BOUNDED
True if we are to run with bounded amount of writers rather than let the count blossom. Default is 'false'. Does not apply if you have set 'hbase.wal.split.to.hfile' as that is always bounded. Only applies when you are doing recovery to 'recovered.edits' files (the old default). Bounded writing tends to have higher throughput.- See Also:
-
SPLIT_WAL_BUFFER_SIZE
- See Also:
-
SPLIT_WAL_WRITER_THREADS
- See Also:
-
numWriterThreads
-
bufferSize
-
splitWriterCreationBounded
-
hfile
-
skipErrors
-
-
Constructor Details
-
WALSplitter
WALSplitter(WALFactory factory, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path walRootDir, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem rootFS) -
WALSplitter
WALSplitter(WALFactory factory, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path walRootDir, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.FileSystem rootFS, LastSequenceId idChecker, SplitLogWorkerCoordination splitLogWorkerCoordination, RegionServerServices rsServices)
-
-
Method Details
-
getWalFactory
-
getFileBeingSplit
org.apache.hadoop.fs.FileStatus getFileBeingSplit() -
getTmpDirName
-
getRegionMaxSeqIdInStores
Map<String,Map<byte[], getRegionMaxSeqIdInStores()Long>> -
splitLogFile
public static boolean splitLogFile(org.apache.hadoop.fs.Path walDir, org.apache.hadoop.fs.FileStatus logfile, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.conf.Configuration conf, CancelableProgressable reporter, LastSequenceId idChecker, SplitLogWorkerCoordination splitLogWorkerCoordination, WALFactory factory, RegionServerServices rsServices) throws IOException Splits a WAL file. Used by oldSplitLogWorker
and tests. Not used by new procedure-based WAL splitter.- Returns:
- false if it is interrupted by the progress-able.
- Throws:
IOException
-
split
public static List<org.apache.hadoop.fs.Path> split(org.apache.hadoop.fs.Path walRootDir, org.apache.hadoop.fs.Path walsDir, org.apache.hadoop.fs.Path archiveDir, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.conf.Configuration conf, WALFactory factory) throws IOException Split a folder of WAL files. Delete the directory when done. Used by tools and unit tests. It should be package private. It is public only because TestWALObserver is in a different package, which uses this method to do log splitting.- Returns:
- List of output files created by the split.
- Throws:
IOException
-
createOutputSinkAndEntryBuffers
Setup the output sinks and entry buffers ahead of splitting WAL. -
splitWAL
WALSplitter.SplitWALResult splitWAL(org.apache.hadoop.fs.FileStatus walStatus, CancelableProgressable cancel) throws IOException WAL splitting implementation, splits one WAL file.- Parameters:
walStatus
- should be for an actual WAL file.- Throws:
IOException
-
isRegionDirPresentUnderRoot
- Throws:
IOException
-
getReader
protected WALStreamReader getReader(org.apache.hadoop.fs.FileStatus walStatus, boolean skipErrors, CancelableProgressable cancel) throws IOException, WALSplitter.CorruptedLogFileException Create a newWALStreamReader
for reading logs to split.- Returns:
- Returns null if file has length zero or file can't be found.
- Throws:
IOException
WALSplitter.CorruptedLogFileException
-
getNextLogLine
private WAL.Entry getNextLogLine(WALStreamReader in, org.apache.hadoop.fs.Path path, boolean skipErrors) throws WALSplitter.CorruptedLogFileException, IOException -
createWriter
Create a newWALProvider.Writer
for writing log splits.- Returns:
- a new Writer instance, caller should close
- Throws:
IOException
-
getReader
private WALStreamReader getReader(org.apache.hadoop.fs.Path curLogFile, CancelableProgressable reporter) throws IOException Create a newWALStreamReader
for reading logs to split.- Returns:
- new Reader instance, caller should close
- Throws:
IOException
-
getNumOpenWriters
Get current open writers
-