@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 |
---|---|
(package private) static void |
archive(org.apache.hadoop.fs.Path wal,
boolean corrupt,
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
|
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.FileStatus[] |
getRecoveredHFiles(org.apache.hadoop.fs.FileSystem rootFS,
org.apache.hadoop.fs.Path regionDir,
String familyName) |
private static org.apache.hadoop.fs.Path |
getRecoveredHFilesDir(org.apache.hadoop.fs.Path regionDir,
String familyName) |
static org.apache.hadoop.fs.Path |
getRegionDirRecoveredEditsDir(org.apache.hadoop.fs.Path regionDir) |
(package private) static org.apache.hadoop.fs.Path |
getRegionSplitEditsPath(TableName tableName,
byte[] encodedRegionName,
long seqId,
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.
|
private static void |
mkdir(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path dir) |
static org.apache.hadoop.fs.Path |
moveAsideBadEditsFile(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path edits)
Move aside a bad edits file.
|
static void |
moveWAL(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path p,
org.apache.hadoop.fs.Path targetDir)
Move WAL.
|
(package private) static org.apache.hadoop.fs.Path |
tryCreateRecoveredHFilesDir(org.apache.hadoop.fs.FileSystem rootFS,
org.apache.hadoop.conf.Configuration conf,
TableName tableName,
String encodedRegionName,
String familyName)
Return path to recovered.hfiles directory of the region's column family: e.g.
|
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.
IOException
static void archive(org.apache.hadoop.fs.Path wal, boolean corrupt, org.apache.hadoop.fs.Path oldWALDir, org.apache.hadoop.fs.FileSystem walFS, org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
private static void mkdir(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path dir) throws IOException
IOException
public static void moveWAL(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path p, org.apache.hadoop.fs.Path targetDir) throws IOException
IOException
static org.apache.hadoop.fs.Path getRegionSplitEditsPath(TableName tableName, byte[] encodedRegionName, long seqId, 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. And also set storage policy for
RECOVERED_EDITS_DIR if WAL_STORAGE_POLICY is configured.tableName
- the table nameencodedRegionName
- the encoded region nameseqId
- the sequence id which used to generate file namefileNameBeingSplit
- 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)
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 fs, org.apache.hadoop.fs.Path edits) throws IOException
fs
- the file system 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
logEntry
- pair of WALKey and WALEdit instance stores WALKey and WALEdit instances
extracted from the passed in WALEntry.IOException
static org.apache.hadoop.fs.Path tryCreateRecoveredHFilesDir(org.apache.hadoop.fs.FileSystem rootFS, org.apache.hadoop.conf.Configuration conf, TableName tableName, String encodedRegionName, String familyName) throws IOException
rootFS
- the root file systemconf
- configurationtableName
- the table nameencodedRegionName
- the encoded region namefamilyName
- the column family nameIOException
private static org.apache.hadoop.fs.Path getRecoveredHFilesDir(org.apache.hadoop.fs.Path regionDir, String familyName)
regionDir
- This regions directory in the filesystemfamilyName
- The column family namepublic static org.apache.hadoop.fs.FileStatus[] getRecoveredHFiles(org.apache.hadoop.fs.FileSystem rootFS, org.apache.hadoop.fs.Path regionDir, String familyName) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.