org.apache.hadoop.hbase.util
Class HBaseFsckRepair

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

public class HBaseFsckRepair
extends Object

This class contains helper methods that repair parts of hbase's filesystem contents.


Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
HBaseFsckRepair()
           
 
Method Summary
static void closeRegionSilentlyAndWait(HBaseAdmin admin, HServerAddress server, HRegionInfo region)
          Contacts a region server and waits up to hbase.hbck.close.timeout ms (default 120s) to close the region.
static HRegion createHDFSRegionDir(org.apache.hadoop.conf.Configuration conf, HRegionInfo hri)
          Creates, flushes, and closes a new hdfs region dir
static void fixMetaHoleOnline(org.apache.hadoop.conf.Configuration conf, HRegionInfo hri)
          Puts the specified HRegionInfo into META.
static void fixMultiAssignment(HBaseAdmin admin, HRegionInfo region, List<HServerAddress> servers)
          Fix dupe assignment by doing silent closes on each RS hosting the region and then force ZK unassigned node to OFFLINE to trigger assignment by master.
static void fixTableDesc(HBaseAdmin admin, HServerAddress hsa, HBaseFsck.HbckInfo hbi, HTableDescriptor htd, org.apache.hadoop.fs.Path sidelineTableDir)
          Replace the .regioninfo with a new one with the expected table desc, then re-assign the region.
static void fixUnassigned(HBaseAdmin admin, HRegionInfo region)
          Fix unassigned by creating/transition the unassigned ZK node for this region to OFFLINE state with a special flag to tell the master that this is a forced operation by HBCK.
static void waitUntilAssigned(HBaseAdmin admin, HRegionInfo region)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

HBaseFsckRepair

public HBaseFsckRepair()
Method Detail

fixMultiAssignment

public static void fixMultiAssignment(HBaseAdmin admin,
                                      HRegionInfo region,
                                      List<HServerAddress> servers)
                               throws IOException,
                                      org.apache.zookeeper.KeeperException,
                                      InterruptedException
Fix dupe assignment by doing silent closes on each RS hosting the region and then force ZK unassigned node to OFFLINE to trigger assignment by master.

Parameters:
conf -
region -
servers -
Throws:
IOException
org.apache.zookeeper.KeeperException
InterruptedException

fixUnassigned

public static void fixUnassigned(HBaseAdmin admin,
                                 HRegionInfo region)
                          throws IOException,
                                 org.apache.zookeeper.KeeperException
Fix unassigned by creating/transition the unassigned ZK node for this region to OFFLINE state with a special flag to tell the master that this is a forced operation by HBCK. This assumes that info is in META.

Parameters:
conf -
region -
Throws:
IOException
org.apache.zookeeper.KeeperException

waitUntilAssigned

public static void waitUntilAssigned(HBaseAdmin admin,
                                     HRegionInfo region)
                              throws IOException,
                                     InterruptedException
Throws:
IOException
InterruptedException

closeRegionSilentlyAndWait

public static void closeRegionSilentlyAndWait(HBaseAdmin admin,
                                              HServerAddress server,
                                              HRegionInfo region)
                                       throws IOException,
                                              InterruptedException
Contacts a region server and waits up to hbase.hbck.close.timeout ms (default 120s) to close the region. This bypasses the active hmaster.

Throws:
IOException
InterruptedException

fixMetaHoleOnline

public static void fixMetaHoleOnline(org.apache.hadoop.conf.Configuration conf,
                                     HRegionInfo hri)
                              throws IOException
Puts the specified HRegionInfo into META.

Throws:
IOException

fixTableDesc

public static void fixTableDesc(HBaseAdmin admin,
                                HServerAddress hsa,
                                HBaseFsck.HbckInfo hbi,
                                HTableDescriptor htd,
                                org.apache.hadoop.fs.Path sidelineTableDir)
                         throws IOException,
                                org.apache.zookeeper.KeeperException,
                                InterruptedException
Replace the .regioninfo with a new one with the expected table desc, then re-assign the region.

Throws:
IOException
org.apache.zookeeper.KeeperException
InterruptedException

createHDFSRegionDir

public static HRegion createHDFSRegionDir(org.apache.hadoop.conf.Configuration conf,
                                          HRegionInfo hri)
                                   throws IOException
Creates, flushes, and closes a new hdfs region dir

Throws:
IOException


Copyright © 2012 Cloudera. All Rights Reserved.