org.apache.hadoop.hbase.util
Class HBaseFsck

java.lang.Object
  extended by org.apache.hadoop.hbase.util.HBaseFsck

public class HBaseFsck
extends Object

Check consistency among the in-memory states of the master and the region server(s) and the state of data in HDFS.


Nested Class Summary
static interface HBaseFsck.ErrorReporter
           
static class HBaseFsck.HbckInfo
          Maintain information about a particular region.
static class HBaseFsck.RegionInfoLoadException
           
 
Field Summary
static long DEFAULT_SLEEP_BEFORE_RERUN
           
static long DEFAULT_TIME_LAG
           
 
Constructor Summary
HBaseFsck(org.apache.hadoop.conf.Configuration conf)
          Constructor
 
Method Summary
 void checkHdfs()
          Scan HDFS for all regions, recording their information into regionInfo
 void connect()
           
 void displayFullReport()
          Display the full report from fsck.
 int doWork()
          Contacts the master and prints out cluster-wide information
 void dumpOverlapProblems(com.google.common.collect.Multimap<byte[],HBaseFsck.HbckInfo> regions)
           
 HBaseFsck.ErrorReporter getErrors()
           
 com.google.common.collect.Multimap<byte[],HBaseFsck.HbckInfo> getOverlapGroups(String table)
           
static void main(String[] args)
          Main program
protected static void printUsageAndExit()
           
 boolean rebuildMeta()
          Rebuilds meta from information in hdfs/fs.
 void setFixErrors(boolean shouldFix)
          Fix inconsistencies found by fsck.
 void setTimeLag(long seconds)
          We are interested in only those tables that have not changed their state in META during the last few seconds specified by hbase.admin.fsck.timelag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIME_LAG

public static final long DEFAULT_TIME_LAG
See Also:
Constant Field Values

DEFAULT_SLEEP_BEFORE_RERUN

public static final long DEFAULT_SLEEP_BEFORE_RERUN
See Also:
Constant Field Values
Constructor Detail

HBaseFsck

public HBaseFsck(org.apache.hadoop.conf.Configuration conf)
          throws MasterNotRunningException,
                 ZooKeeperConnectionException,
                 IOException
Constructor

Parameters:
conf - Configuration object
Throws:
MasterNotRunningException - if the master is not running
ZooKeeperConnectionException - if unable to connect to zookeeper
IOException
Method Detail

connect

public void connect()
             throws MasterNotRunningException,
                    ZooKeeperConnectionException
Throws:
MasterNotRunningException
ZooKeeperConnectionException

doWork

public int doWork()
           throws IOException,
                  org.apache.zookeeper.KeeperException,
                  InterruptedException
Contacts the master and prints out cluster-wide information

Returns:
0 on success, non-zero on failure
Throws:
IOException - if a remote or network exception occurs
org.apache.zookeeper.KeeperException
InterruptedException

getErrors

public HBaseFsck.ErrorReporter getErrors()

rebuildMeta

public boolean rebuildMeta()
                    throws IOException,
                           InterruptedException
Rebuilds meta from information in hdfs/fs. Depends on configuration settings passed into hbck constructor to point to a particular fs/dir.

Returns:
true if successful, false if attempt failed.
Throws:
IOException
InterruptedException

checkHdfs

public void checkHdfs()
               throws IOException,
                      InterruptedException
Scan HDFS for all regions, recording their information into regionInfo

Throws:
IOException
InterruptedException

dumpOverlapProblems

public void dumpOverlapProblems(com.google.common.collect.Multimap<byte[],HBaseFsck.HbckInfo> regions)

getOverlapGroups

public com.google.common.collect.Multimap<byte[],HBaseFsck.HbckInfo> getOverlapGroups(String table)

displayFullReport

public void displayFullReport()
Display the full report from fsck. This displays all live and dead region servers, and all known regions.


setFixErrors

public void setFixErrors(boolean shouldFix)
Fix inconsistencies found by fsck. This should try to fix errors (if any) found by fsck utility.


setTimeLag

public void setTimeLag(long seconds)
We are interested in only those tables that have not changed their state in META during the last few seconds specified by hbase.admin.fsck.timelag

Parameters:
seconds - - the time in seconds

printUsageAndExit

protected static void printUsageAndExit()

main

public static void main(String[] args)
                 throws Exception
Main program

Parameters:
args -
Throws:
HBaseFsck.RegionInfoLoadException
Exception


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