HBASE-16647 hbck should do offline reference repair before online repair

This commit is contained in:
Jerry He 2016-09-20 11:49:09 -07:00
parent 91d03697d9
commit abfb20206d
1 changed files with 6 additions and 4 deletions

View File

@ -638,7 +638,6 @@ public class HBaseFsck extends Configured implements Closeable {
*/ */
public int onlineConsistencyRepair() throws IOException, KeeperException, public int onlineConsistencyRepair() throws IOException, KeeperException,
InterruptedException { InterruptedException {
clearState();
// get regions according to what is online on each RegionServer // get regions according to what is online on each RegionServer
loadDeployedRegions(); loadDeployedRegions();
@ -756,8 +755,12 @@ public class HBaseFsck extends Configured implements Closeable {
throws IOException, KeeperException, InterruptedException, ServiceException { throws IOException, KeeperException, InterruptedException, ServiceException {
// print hbase server version // print hbase server version
errors.print("Version: " + status.getHBaseVersion()); errors.print("Version: " + status.getHBaseVersion());
offlineHdfsIntegrityRepair();
// Clean start
clearState();
// Do offline check and repair first
offlineHdfsIntegrityRepair();
offlineReferenceFileRepair();
// If Master runs maintenance tasks (such as balancer, catalog janitor, etc) during online // If Master runs maintenance tasks (such as balancer, catalog janitor, etc) during online
// hbck, it is likely that hbck would be misled and report transient errors. Therefore, it // hbck, it is likely that hbck would be misled and report transient errors. Therefore, it
// is better to set Master into maintenance mode during online hbck. // is better to set Master into maintenance mode during online hbck.
@ -773,8 +776,6 @@ public class HBaseFsck extends Configured implements Closeable {
checkRegionBoundaries(); checkRegionBoundaries();
} }
offlineReferenceFileRepair();
checkAndFixTableLocks(); checkAndFixTableLocks();
// Check (and fix if requested) orphaned table ZNodes // Check (and fix if requested) orphaned table ZNodes
@ -1079,6 +1080,7 @@ public class HBaseFsck extends Configured implements Closeable {
* be fixed before a cluster can start properly. * be fixed before a cluster can start properly.
*/ */
private void offlineReferenceFileRepair() throws IOException, InterruptedException { private void offlineReferenceFileRepair() throws IOException, InterruptedException {
clearState();
Configuration conf = getConf(); Configuration conf = getConf();
Path hbaseRoot = FSUtils.getRootDir(conf); Path hbaseRoot = FSUtils.getRootDir(conf);
FileSystem fs = hbaseRoot.getFileSystem(conf); FileSystem fs = hbaseRoot.getFileSystem(conf);