@InterfaceAudience.Private public final class WALSplitUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
WALSplitUtil.MutationReplay
A struct used by getMutationsFromWALEntry
|
Modifier and Type | Field and Description |
---|---|
private static Pattern |
EDITFILES_NAME_PATTERN |
private static org.slf4j.Logger |
LOG |
private static String |
OLD_SEQUENCE_ID_FILE_SUFFIX |
private static String |
RECOVERED_LOG_TMPFILE_SUFFIX |
private static String |
SEQUENCE_ID_FILE_SUFFIX |
private static int |
SEQUENCE_ID_FILE_SUFFIX_LENGTH |
Modifier | Constructor and Description |
---|---|
private |
WALSplitUtil() |
Modifier and Type | Method and Description |
---|---|
private static void |
archiveWALs(List<org.apache.hadoop.fs.Path> corruptedWALs,
List<org.apache.hadoop.fs.Path> processedWALs,
org.apache.hadoop.fs.Path oldWALDir,
org.apache.hadoop.fs.FileSystem walFS,
org.apache.hadoop.conf.Configuration conf)
Moves processed logs to a oldLogDir after successful processing Moves corrupted logs (any log
that couldn't be successfully parsed to corruptDir (.corrupt) for later investigation
|
(package private) static void |
finishSplitLogFile(org.apache.hadoop.fs.Path walDir,
org.apache.hadoop.fs.Path oldWALDir,
org.apache.hadoop.fs.Path walPath,
org.apache.hadoop.conf.Configuration conf) |
static void |
finishSplitLogFile(String logfile,
org.apache.hadoop.conf.Configuration conf)
Completes the work done by splitLogFile by archiving logs
|
(package private) static String |
formatRecoveredEditsFileName(long seqid) |
(package private) static org.apache.hadoop.fs.Path |
getCompletedRecoveredEditsFilePath(org.apache.hadoop.fs.Path srcPath,
long maximumEditWALSeqNum)
Get the completed recovered edits file path, renaming it to be by last edit in the file from
its first edit.
|
static long |
getMaxRegionSequenceId(org.apache.hadoop.conf.Configuration conf,
RegionInfo region,
ConcurrentMapUtils.IOExceptionSupplier<org.apache.hadoop.fs.FileSystem> rootFsSupplier,
ConcurrentMapUtils.IOExceptionSupplier<org.apache.hadoop.fs.FileSystem> walFsSupplier)
Deprecated.
Only for compatibility, will be removed in 4.0.0.
|
static long |
getMaxRegionSequenceId(org.apache.hadoop.fs.FileSystem walFS,
org.apache.hadoop.fs.Path regionDir)
Get the max sequence id which is stored in the region directory.
|
private static long |
getMaxSequenceId(org.apache.hadoop.fs.FileStatus[] files) |
static List<WALSplitUtil.MutationReplay> |
getMutationsFromWALEntry(org.apache.hadoop.hbase.shaded.protobuf.generated.AdminProtos.WALEntry entry,
CellScanner cells,
Pair<WALKey,WALEdit> logEntry,
Durability durability)
This function is used to construct mutations from a WALEntry.
|
static org.apache.hadoop.fs.Path |
getRegionDirRecoveredEditsDir(org.apache.hadoop.fs.Path regionDir) |
(package private) static org.apache.hadoop.fs.Path |
getRegionSplitEditsPath(WAL.Entry walEntry,
String fileNameBeingSplit,
String tmpDirName,
org.apache.hadoop.conf.Configuration conf)
Path to a file under RECOVERED_EDITS_DIR directory of the region found in
logEntry
named for the sequenceid in the passed logEntry : e.g. |
private static org.apache.hadoop.fs.FileStatus[] |
getSequenceIdFiles(org.apache.hadoop.fs.FileSystem walFS,
org.apache.hadoop.fs.Path regionDir) |
static NavigableSet<org.apache.hadoop.fs.Path> |
getSplitEditFilesSorted(org.apache.hadoop.fs.FileSystem walFS,
org.apache.hadoop.fs.Path regionDir)
Returns sorted set of edit files made by splitter, excluding files with '.temp' suffix.
|
private static String |
getTmpRecoveredEditsFileName(String fileName) |
static boolean |
hasRecoveredEdits(org.apache.hadoop.conf.Configuration conf,
RegionInfo regionInfo)
Check whether there is recovered.edits in the region dir
|
static boolean |
isSequenceIdFile(org.apache.hadoop.fs.Path file)
Is the given file a region open sequence id file.
|
static org.apache.hadoop.fs.Path |
moveAsideBadEditsFile(org.apache.hadoop.fs.FileSystem walFS,
org.apache.hadoop.fs.Path edits)
Move aside a bad edits file.
|
static void |
writeRegionSequenceIdFile(org.apache.hadoop.fs.FileSystem walFS,
org.apache.hadoop.fs.Path regionDir,
long newMaxSeqId)
Create a file with name as region's max sequence id
|
private static final org.slf4j.Logger LOG
private static final Pattern EDITFILES_NAME_PATTERN
private static final String RECOVERED_LOG_TMPFILE_SUFFIX
private static final String SEQUENCE_ID_FILE_SUFFIX
private static final String OLD_SEQUENCE_ID_FILE_SUFFIX
private static final int SEQUENCE_ID_FILE_SUFFIX_LENGTH
private WALSplitUtil()
public static void finishSplitLogFile(String logfile, org.apache.hadoop.conf.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
static void finishSplitLogFile(org.apache.hadoop.fs.Path walDir, org.apache.hadoop.fs.Path oldWALDir, org.apache.hadoop.fs.Path walPath, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
private static void archiveWALs(List<org.apache.hadoop.fs.Path> corruptedWALs, List<org.apache.hadoop.fs.Path> processedWALs, org.apache.hadoop.fs.Path oldWALDir, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
static org.apache.hadoop.fs.Path getRegionSplitEditsPath(WAL.Entry walEntry, String fileNameBeingSplit, String tmpDirName, org.apache.hadoop.conf.Configuration conf) throws IOException
logEntry
named for the sequenceid in the passed logEntry
: e.g.
/hbase/some_table/2323432434/recovered.edits/2332. This method also ensures existence of
RECOVERED_EDITS_DIR under the region creating it if necessary.walEntry
- walEntry to recoverfileNameBeingSplit
- the file being split currently. Used to generate tmp file name.tmpDirName
- of the directory used to sideline old recovered edits fileconf
- configurationIOException
private static String getTmpRecoveredEditsFileName(String fileName)
static org.apache.hadoop.fs.Path getCompletedRecoveredEditsFilePath(org.apache.hadoop.fs.Path srcPath, long maximumEditWALSeqNum)
HRegion.replayRecoveredEditsIfAny(java.util.Map<byte[], java.lang.Long>, org.apache.hadoop.hbase.util.CancelableProgressable, org.apache.hadoop.hbase.monitoring.MonitoredTask)
.static String formatRecoveredEditsFileName(long seqid)
public static org.apache.hadoop.fs.Path getRegionDirRecoveredEditsDir(org.apache.hadoop.fs.Path regionDir)
regionDir
- This regions directory in the filesystem.regionDir
public static boolean hasRecoveredEdits(org.apache.hadoop.conf.Configuration conf, RegionInfo regionInfo) throws IOException
conf
- confregionInfo
- the region to checkIOException
@Deprecated public static long getMaxRegionSequenceId(org.apache.hadoop.conf.Configuration conf, RegionInfo region, ConcurrentMapUtils.IOExceptionSupplier<org.apache.hadoop.fs.FileSystem> rootFsSupplier, ConcurrentMapUtils.IOExceptionSupplier<org.apache.hadoop.fs.FileSystem> walFsSupplier) throws IOException
getMaxRegionSequenceId(FileSystem, Path)
until 4.0.0 release.IOException
public static NavigableSet<org.apache.hadoop.fs.Path> getSplitEditFilesSorted(org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path regionDir) throws IOException
walFS
- WAL FileSystem used to retrieving split edits files.regionDir
- WAL region dir to look for recovered edits files under.regionDir
as a sorted set.IOException
public static org.apache.hadoop.fs.Path moveAsideBadEditsFile(org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path edits) throws IOException
walFS
- WAL FileSystem used to rename bad edits file.edits
- Edits file to move aside.IOException
public static boolean isSequenceIdFile(org.apache.hadoop.fs.Path file)
private static org.apache.hadoop.fs.FileStatus[] getSequenceIdFiles(org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path regionDir) throws IOException
IOException
private static long getMaxSequenceId(org.apache.hadoop.fs.FileStatus[] files)
public static long getMaxRegionSequenceId(org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path regionDir) throws IOException
IOException
public static void writeRegionSequenceIdFile(org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.fs.Path regionDir, long newMaxSeqId) throws IOException
IOException
public static List<WALSplitUtil.MutationReplay> getMutationsFromWALEntry(org.apache.hadoop.hbase.shaded.protobuf.generated.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.IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.