Package org.apache.hadoop.hbase.util
Class HBaseFsckRepair
java.lang.Object
org.apache.hadoop.hbase.util.HBaseFsckRepair
This class contains helper methods that repair parts of hbase's filesystem contents.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
closeRegionSilentlyAndWait
(Connection connection, ServerName server, RegionInfo 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, RegionInfo hri, TableDescriptor htd) Creates, flushes, and closes a new region.static void
fixMetaHoleOnlineAndAddReplicas
(org.apache.hadoop.conf.Configuration conf, RegionInfo hri, Collection<ServerName> servers, int numReplicas) Puts the specified RegionInfo into META with replica related columnsstatic void
fixMultiAssignment
(Connection connection, RegionInfo region, List<ServerName> servers) Fix multiple 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
fixUnassigned
(Admin admin, RegionInfo 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.private static void
forceOfflineInZK
(Admin admin, RegionInfo region) In 0.90, this forces an HRI offline by setting the RegionTransitionData in ZK to have HBCK_CODE_NAME as the server.static void
removeParentInMeta
(org.apache.hadoop.conf.Configuration conf, RegionInfo hri) static void
waitUntilAssigned
(Admin admin, RegionInfo region)
-
Field Details
-
LOG
-
-
Constructor Details
-
HBaseFsckRepair
public HBaseFsckRepair()
-
-
Method Details
-
fixMultiAssignment
public static void fixMultiAssignment(Connection connection, RegionInfo region, List<ServerName> servers) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException Fix multiple 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:
connection
- HBase connection to the clusterregion
- Region to undeployservers
- list of Servers to undeploy from- Throws:
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
fixUnassigned
public static void fixUnassigned(Admin admin, RegionInfo region) throws IOException, org.apache.zookeeper.KeeperException, InterruptedException 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.- Throws:
IOException
org.apache.zookeeper.KeeperException
InterruptedException
-
forceOfflineInZK
private static void forceOfflineInZK(Admin admin, RegionInfo region) throws ZooKeeperConnectionException, org.apache.zookeeper.KeeperException, IOException, InterruptedException In 0.90, this forces an HRI offline by setting the RegionTransitionData in ZK to have HBCK_CODE_NAME as the server. This is a special case in the AssignmentManager that attempts an assign call by the master. This doesn't seem to work properly in the updated version of 0.92+'s hbck so we use assign to force the region into transition. This has the side-effect of requiring a RegionInfo that considers regionId (timestamp) in comparators that is addressed by HBASE-5563.- Throws:
ZooKeeperConnectionException
org.apache.zookeeper.KeeperException
IOException
InterruptedException
-
waitUntilAssigned
public static void waitUntilAssigned(Admin admin, RegionInfo region) throws IOException, InterruptedException - Throws:
IOException
InterruptedException
-
closeRegionSilentlyAndWait
public static void closeRegionSilentlyAndWait(Connection connection, ServerName server, RegionInfo 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
-
fixMetaHoleOnlineAndAddReplicas
public static void fixMetaHoleOnlineAndAddReplicas(org.apache.hadoop.conf.Configuration conf, RegionInfo hri, Collection<ServerName> servers, int numReplicas) throws IOException Puts the specified RegionInfo into META with replica related columns- Throws:
IOException
-
createHDFSRegionDir
public static HRegion createHDFSRegionDir(org.apache.hadoop.conf.Configuration conf, RegionInfo hri, TableDescriptor htd) throws IOException Creates, flushes, and closes a new region.- Throws:
IOException
-
removeParentInMeta
public static void removeParentInMeta(org.apache.hadoop.conf.Configuration conf, RegionInfo hri) throws IOException - Throws:
IOException
-