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

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

public class HLogSplitter
extends java.lang.Object

This class is responsible for splitting up a bunch of regionserver commit log files that are no longer being written to, into new files, one per region for region to replay on startup. Delete the old log files when finished.


Field Summary
protected  org.apache.hadoop.conf.Configuration conf
           
protected  org.apache.hadoop.fs.FileSystem fs
           
protected  org.apache.hadoop.fs.Path oldLogDir
           
static java.lang.String RECOVERED_EDITS
          Name of file that holds recovered edits written by the wal log splitting code, one per region
protected  org.apache.hadoop.fs.Path rootDir
           
protected  org.apache.hadoop.fs.Path srcDir
           
protected  java.util.concurrent.atomic.AtomicReference<java.lang.Throwable> thrown
           
 
Constructor Summary
HLogSplitter(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.Path srcDir, org.apache.hadoop.fs.Path oldLogDir, org.apache.hadoop.fs.FileSystem fs)
           
 
Method Summary
static HLogSplitter createLogSplitter(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path rootDir, org.apache.hadoop.fs.Path srcDir, org.apache.hadoop.fs.Path oldLogDir, org.apache.hadoop.fs.FileSystem fs)
          Create a new HLogSplitter using the given Configuration and the hbase.hlog.splitter.impl property to derived the instance class to use.
protected  HLog.Writer createWriter(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path logfile, org.apache.hadoop.conf.Configuration conf)
          Create a new HLog.Writer for writing log splits.
protected  HLog.Reader getReader(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path curLogFile, org.apache.hadoop.conf.Configuration conf)
          Create a new HLog.Reader for reading logs to split.
 long getSize()
           
 long getTime()
           
 java.util.List<org.apache.hadoop.fs.Path> splitLog()
          Split up a bunch of regionserver commit log files that are no longer being written to, into new files, one per region for region to replay on startup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RECOVERED_EDITS

public static final java.lang.String RECOVERED_EDITS
Name of file that holds recovered edits written by the wal log splitting code, one per region

See Also:
Constant Field Values

rootDir

protected final org.apache.hadoop.fs.Path rootDir

srcDir

protected final org.apache.hadoop.fs.Path srcDir

oldLogDir

protected final org.apache.hadoop.fs.Path oldLogDir

fs

protected final org.apache.hadoop.fs.FileSystem fs

conf

protected final org.apache.hadoop.conf.Configuration conf

thrown

protected java.util.concurrent.atomic.AtomicReference<java.lang.Throwable> thrown
Constructor Detail

HLogSplitter

public HLogSplitter(org.apache.hadoop.conf.Configuration conf,
                    org.apache.hadoop.fs.Path rootDir,
                    org.apache.hadoop.fs.Path srcDir,
                    org.apache.hadoop.fs.Path oldLogDir,
                    org.apache.hadoop.fs.FileSystem fs)
Method Detail

createLogSplitter

public static HLogSplitter createLogSplitter(org.apache.hadoop.conf.Configuration conf,
                                             org.apache.hadoop.fs.Path rootDir,
                                             org.apache.hadoop.fs.Path srcDir,
                                             org.apache.hadoop.fs.Path oldLogDir,
                                             org.apache.hadoop.fs.FileSystem fs)
Create a new HLogSplitter using the given Configuration and the hbase.hlog.splitter.impl property to derived the instance class to use.

Parameters:
conf -
rootDir - hbase directory
srcDir - logs directory
oldLogDir - directory where processed logs are archived to
fs - FileSystem

splitLog

public java.util.List<org.apache.hadoop.fs.Path> splitLog()
                                                   throws java.io.IOException
Split up a bunch of regionserver commit log files that are no longer being written to, into new files, one per region for region to replay on startup. Delete the old log files when finished.

Returns:
the list of splits
Throws:
java.io.IOException - will throw if corrupted hlogs aren't tolerated

getTime

public long getTime()
Returns:
time that this split took

getSize

public long getSize()
Returns:
aggregate size of hlogs that were split

createWriter

protected HLog.Writer createWriter(org.apache.hadoop.fs.FileSystem fs,
                                   org.apache.hadoop.fs.Path logfile,
                                   org.apache.hadoop.conf.Configuration conf)
                            throws java.io.IOException
Create a new HLog.Writer for writing log splits.

Throws:
java.io.IOException

getReader

protected HLog.Reader getReader(org.apache.hadoop.fs.FileSystem fs,
                                org.apache.hadoop.fs.Path curLogFile,
                                org.apache.hadoop.conf.Configuration conf)
                         throws java.io.IOException
Create a new HLog.Reader for reading logs to split.

Throws:
java.io.IOException


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.