Index: src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (revision 1305770) +++ src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java (working copy) @@ -975,6 +975,13 @@ if (!foundVersionFile) { errors.reportError(ERROR_CODE.NO_VERSION_FILE, "Version file does not exist in root dir " + rootDir); + if (shouldFixAssignments()) { + LOG.info("Trying to create a new " + HConstants.VERSION_FILE_NAME + + " file."); + setShouldRerun(); + FSUtils.setVersion(fs, rootDir, + conf.getInt(HConstants.THREAD_WAKE_FREQUENCY, 10 * 1000)); + } } // level 1: /* @@ -1302,10 +1309,15 @@ + " not deployed on any region server."); tryAssignmentRepair(hbi, "Trying to fix unassigned region..."); } else if (inMeta && inHdfs && isDeployed && !shouldBeDeployed) { - errors.reportError(ERROR_CODE.SHOULD_NOT_BE_DEPLOYED, "UNHANDLED CASE:" + - " Region " + descriptiveName + " should not be deployed according " + + errors.reportError(ERROR_CODE.SHOULD_NOT_BE_DEPLOYED, + "Region " + descriptiveName + " should not be deployed according " + "to META, but is deployed on " + Joiner.on(", ").join(hbi.deployedOn)); // TODO test and handle this case. + if (shouldFixAssignments()) { + errors.print("Trying to unassign the region " + descriptiveName); + setShouldRerun(); + admin.getMaster().unassign(hbi.metaEntry.getRegionName(), false); + } } else if (inMeta && inHdfs && isMultiplyDeployed) { errors.reportError(ERROR_CODE.MULTI_DEPLOYED, "Region " + descriptiveName + " is listed in META on region server " + hbi.metaEntry.regionServer Index: src/main/java/org/apache/hadoop/hbase/util/Merge.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/Merge.java (revision 1305770) +++ src/main/java/org/apache/hadoop/hbase/util/Merge.java (working copy) @@ -381,6 +381,12 @@ LOG.error("exiting due to error", e); status = -1; } + + if (0 == status) { + LOG.info("Success to merge the regions."); + } else { + LOG.error("Failed to merge the regions."); + } System.exit(status); } }