org.apache.hadoop.hbase.regionserver.wal
Class HLogUtil

java.lang.Object
  extended by org.apache.hadoop.hbase.regionserver.wal.HLogUtil

@InterfaceAudience.Private
public class HLogUtil
extends Object


Constructor Summary
HLogUtil()
           
 
Method Summary
static String getHLogDirectoryName(String serverName)
          Construct the HLog directory name
static org.apache.hadoop.fs.Path getRegionDirRecoveredEditsDir(org.apache.hadoop.fs.Path regiondir)
           
static ServerName getServerNameFromHLogDirectoryName(org.apache.hadoop.conf.Configuration conf, String path)
           
static ServerName getServerNameFromHLogDirectoryName(org.apache.hadoop.fs.Path logFile)
          This function returns region server name from a log file name which is in either format: hdfs:///hbase/.logs/-splitting/...
static NavigableSet<org.apache.hadoop.fs.Path> getSplitEditFilesSorted(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path regiondir)
          Returns sorted set of edit files made by wal-log splitter, excluding files with '.temp' suffix.
static boolean isMetaFile(org.apache.hadoop.fs.Path p)
           
static boolean isMetaFile(String p)
           
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 boolean validateHLogFilename(String filename)
           
static void writeCompactionMarker(HLog log, HTableDescriptor htd, HRegionInfo info, WALProtos.CompactionDescriptor c, AtomicLong sequenceId)
          Write the marker that a compaction has succeeded and is about to be committed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HLogUtil

public HLogUtil()
Method Detail

validateHLogFilename

public static boolean validateHLogFilename(String filename)
Parameters:
filename - name of the file to validate
Returns:
true if the filename matches an HLog, false otherwise

getHLogDirectoryName

public static String getHLogDirectoryName(String serverName)
Construct the HLog directory name

Parameters:
serverName - Server name formatted as described in ServerName
Returns:
the relative HLog directory name, e.g. .logs/1.example.org,60030,12345 if serverName passed is 1.example.org,60030,12345

getRegionDirRecoveredEditsDir

public static org.apache.hadoop.fs.Path getRegionDirRecoveredEditsDir(org.apache.hadoop.fs.Path regiondir)
Parameters:
regiondir - This regions directory in the filesystem.
Returns:
The directory that holds recovered edits files for the region regiondir

moveAsideBadEditsFile

public static org.apache.hadoop.fs.Path moveAsideBadEditsFile(org.apache.hadoop.fs.FileSystem fs,
                                                              org.apache.hadoop.fs.Path edits)
                                                       throws IOException
Move aside a bad edits file.

Parameters:
fs -
edits - Edits file to move aside.
Returns:
The name of the moved aside file.
Throws:
IOException

getServerNameFromHLogDirectoryName

public static ServerName getServerNameFromHLogDirectoryName(org.apache.hadoop.conf.Configuration conf,
                                                            String path)
                                                     throws IOException
Parameters:
path - - the path to analyze. Expected format, if it's in hlog directory: / [base directory for hbase] / hbase / .logs / ServerName / logfile
Returns:
null if it's not a log file. Returns the ServerName of the region server that created this log file otherwise.
Throws:
IOException

getServerNameFromHLogDirectoryName

public static ServerName getServerNameFromHLogDirectoryName(org.apache.hadoop.fs.Path logFile)
This function returns region server name from a log file name which is in either format: hdfs:///hbase/.logs/-splitting/... or hdfs:///hbase/.logs//...

Parameters:
logFile -
Returns:
null if the passed in logFile isn't a valid HLog file path

getSplitEditFilesSorted

public static NavigableSet<org.apache.hadoop.fs.Path> getSplitEditFilesSorted(org.apache.hadoop.fs.FileSystem fs,
                                                                              org.apache.hadoop.fs.Path regiondir)
                                                                       throws IOException
Returns sorted set of edit files made by wal-log splitter, excluding files with '.temp' suffix.

Parameters:
fs -
regiondir -
Returns:
Files in passed regiondir as a sorted set.
Throws:
IOException

isMetaFile

public static boolean isMetaFile(org.apache.hadoop.fs.Path p)

isMetaFile

public static boolean isMetaFile(String p)

writeCompactionMarker

public static void writeCompactionMarker(HLog log,
                                         HTableDescriptor htd,
                                         HRegionInfo info,
                                         WALProtos.CompactionDescriptor c,
                                         AtomicLong sequenceId)
                                  throws IOException
Write the marker that a compaction has succeeded and is about to be committed. This provides info to the HMaster to allow it to recover the compaction if this regionserver dies in the middle (This part is not yet implemented). It also prevents the compaction from finishing if this regionserver has already lost its lease on the log.

Parameters:
sequenceId - Used by HLog to get sequence Id for the waledit.
Throws:
IOException


Copyright © 2015 The Apache Software Foundation. All rights reserved.