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
Nested ClassesModifier and TypeClassDescription(package private) static classstatic classContains some methods to control WAL-entries producer / consumer interactions(package private) static final classData structure returned as result by #splitWAL(FileStatus, CancelableProgressable). -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprotected final org.apache.hadoop.conf.Configurationstatic final booleanprivate EntryBuffersprivate org.apache.hadoop.fs.FileStatusprivate final booleanprivate static final org.slf4j.Loggerprivate final int(package private) OutputSink(package private) final org.apache.hadoop.fs.Path(package private) final org.apache.hadoop.fs.FileSystem(package private) final RegionServerServicesprotected final LastSequenceIdprivate final booleanstatic final booleanBy default we retry errors in splitting, rather than skipping.static final Stringstatic final Stringstatic final Stringstatic final StringTrue if we are to run with bounded amount of writers rather than let the count blossom.private SplitLogWorkerCoordinationCoordinator for split log.private final booleanprivate final Stringstatic final StringSplit WAL directly to hfiles instead of into intermediary 'recovered.edits' files.private final WALFactoryprotected final org.apache.hadoop.fs.FileSystemprotected final org.apache.hadoop.fs.Path -
Constructor Summary
ConstructorsConstructorDescriptionWALSplitter(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 voidSetup the output sinks and entry buffers ahead of splitting WAL.protected WALProvider.WritercreateWriter(org.apache.hadoop.fs.Path logfile) Create a newWALProvider.Writerfor writing log splits.(package private) org.apache.hadoop.fs.FileStatusprivate WAL.EntrygetNextLogLine(WALStreamReader in, org.apache.hadoop.fs.Path path, boolean skipErrors) private intGet current open writersprotected WALStreamReadergetReader(org.apache.hadoop.fs.FileStatus walStatus, boolean skipErrors, CancelableProgressable cancel) Create a newWALStreamReaderfor reading logs to split.private WALStreamReadergetReader(org.apache.hadoop.fs.Path curLogFile, CancelableProgressable reporter) Create a newWALStreamReaderfor reading logs to split.(package private) String(package private) WALFactoryprivate booleanisRegionDirPresentUnderRoot(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 booleansplitLogFile(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.SplitWALResultsplitWAL(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 oldSplitLogWorkerand 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 newWALStreamReaderfor reading logs to split.- Returns:
- Returns null if file has length zero or file can't be found.
- Throws:
IOExceptionWALSplitter.CorruptedLogFileException
-
getNextLogLine
private WAL.Entry getNextLogLine(WALStreamReader in, org.apache.hadoop.fs.Path path, boolean skipErrors) throws WALSplitter.CorruptedLogFileException, IOException -
createWriter
Create a newWALProvider.Writerfor 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 newWALStreamReaderfor reading logs to split.- Returns:
- new Reader instance, caller should close
- Throws:
IOException
-
getNumOpenWriters
Get current open writers
-