@InterfaceAudience.Private public class WALSplitter extends Object
Modifier and Type | Class and Description |
---|---|
static class |
WALSplitter.EntryBuffers
Class which accumulates edits and separates them into a buffer per region
while simultaneously accounting RAM usage.
|
static class |
WALSplitter.MutationReplay
A struct used by getMutationsFromWALEntry
|
static class |
WALSplitter.OutputSink
The following class is an abstraction class to provide a common interface to support both
existing recovered edits file sink and region server WAL edits replay sink
|
static class |
WALSplitter.PipelineController
Contains some methods to control WAL-entries producer / consumer interactions
|
static class |
WALSplitter.RegionEntryBuffer
A buffer of some number of edits for a given region.
|
static class |
WALSplitter.SinkWriter
Class wraps the actual writer which writes data out and related statistics
|
static class |
WALSplitter.WriterThread |
Modifier and Type | Field and Description |
---|---|
protected Configuration |
conf |
protected boolean |
distributedLogReplay |
protected String |
failedServerName |
protected FileSystem |
fs |
protected Map<String,Long> |
lastFlushedSequenceIds |
protected Map<String,Map<byte[],Long>> |
regionMaxSeqIdInStores |
protected Path |
rootDir |
protected LastSequenceId |
sequenceIdChecker |
static boolean |
SPLIT_SKIP_ERRORS_DEFAULT
By default we retry errors in splitting, rather than skipping.
|
Modifier and Type | Method and Description |
---|---|
protected WALProvider.Writer |
createWriter(Path logfile)
Create a new
WALProvider.Writer for writing log splits. |
static void |
finishSplitLogFile(String logfile,
Configuration conf)
Completes the work done by splitLogFile by archiving logs
|
static List<WALSplitter.MutationReplay> |
getMutationsFromWALEntry(AdminProtos.WALEntry entry,
CellScanner cells,
Pair<WALKey,WALEdit> logEntry,
Durability durability)
This function is used to construct mutations from a WALEntry.
|
protected WAL.Reader |
getReader(FileStatus file,
boolean skipErrors,
CancelableProgressable reporter)
Create a new
WAL.Reader for reading logs to split. |
protected WAL.Reader |
getReader(Path curLogFile,
CancelableProgressable reporter)
Create a new
WAL.Reader for reading logs to split. |
static Path |
getRegionDirRecoveredEditsDir(Path regiondir) |
static NavigableSet<Path> |
getSplitEditFilesSorted(FileSystem fs,
Path regiondir)
Returns sorted set of edit files made by splitter, excluding files
with '.temp' suffix.
|
static boolean |
isSequenceIdFile(Path file)
Is the given file a region open sequence id file.
|
static Path |
moveAsideBadEditsFile(FileSystem fs,
Path edits)
Move aside a bad edits file.
|
static List<Path> |
split(Path rootDir,
Path logDir,
Path oldLogDir,
FileSystem fs,
Configuration conf,
WALFactory factory) |
static boolean |
splitLogFile(Path rootDir,
FileStatus logfile,
FileSystem fs,
Configuration conf,
CancelableProgressable reporter,
LastSequenceId idChecker,
CoordinatedStateManager cp,
ZooKeeperProtos.SplitLogTask.RecoveryMode mode,
WALFactory factory)
Splits a WAL file into region's recovered-edits directory.
|
static long |
writeRegionSequenceIdFile(FileSystem fs,
Path regiondir,
long newSeqId,
long saftyBumper)
Create a file with name as region open sequence id
|
public static final boolean SPLIT_SKIP_ERRORS_DEFAULT
protected final Path rootDir
protected final FileSystem fs
protected final Configuration conf
protected final LastSequenceId sequenceIdChecker
protected boolean distributedLogReplay
protected String failedServerName
public static boolean splitLogFile(Path rootDir, FileStatus logfile, FileSystem fs, Configuration conf, CancelableProgressable reporter, LastSequenceId idChecker, CoordinatedStateManager cp, ZooKeeperProtos.SplitLogTask.RecoveryMode mode, WALFactory factory) throws IOException
If the log file has N regions then N recovered.edits files will be produced.
rootDir
- logfile
- fs
- conf
- reporter
- idChecker
- cp
- coordination state managerIOException
public static List<Path> split(Path rootDir, Path logDir, Path oldLogDir, FileSystem fs, Configuration conf, WALFactory factory) throws IOException
IOException
public static void finishSplitLogFile(String logfile, Configuration conf) throws IOException
It is invoked by SplitLogManager once it knows that one of the SplitLogWorkers have completed the splitLogFile() part. If the master crashes then this function might get called multiple times.
logfile
- conf
- IOException
public static Path getRegionDirRecoveredEditsDir(Path regiondir)
regiondir
- This regions directory in the filesystem.regiondir
public static NavigableSet<Path> getSplitEditFilesSorted(FileSystem fs, Path regiondir) throws IOException
fs
- regiondir
- regiondir
as a sorted set.IOException
public static Path moveAsideBadEditsFile(FileSystem fs, Path edits) throws IOException
fs
- edits
- Edits file to move aside.IOException
public static boolean isSequenceIdFile(Path file)
public static long writeRegionSequenceIdFile(FileSystem fs, Path regiondir, long newSeqId, long saftyBumper) throws IOException
fs
- regiondir
- newSeqId
- saftyBumper
- IOException
protected WAL.Reader getReader(FileStatus file, boolean skipErrors, CancelableProgressable reporter) throws IOException, org.apache.hadoop.hbase.wal.WALSplitter.CorruptedLogFileException
WAL.Reader
for reading logs to split.file
- IOException
CorruptedLogFileException
org.apache.hadoop.hbase.wal.WALSplitter.CorruptedLogFileException
protected WALProvider.Writer createWriter(Path logfile) throws IOException
WALProvider.Writer
for writing log splits.IOException
protected WAL.Reader getReader(Path curLogFile, CancelableProgressable reporter) throws IOException
WAL.Reader
for reading logs to split.IOException
public static List<WALSplitter.MutationReplay> getMutationsFromWALEntry(AdminProtos.WALEntry entry, CellScanner cells, Pair<WALKey,WALEdit> logEntry, Durability durability) throws IOException
entry
- cells
- logEntry
- pair of WALKey and WALEdit instance stores WALKey and WALEdit instances
extracted from the passed in WALEntry.durability
- IOException