From 1da8a78ff9429687f0da6c7a463cbd083aa43479 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Sat, 4 Dec 2010 00:10:23 +0000 Subject: [PATCH] Some fixup of hbck log messages -- added info git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1042060 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/hadoop/hbase/util/HBaseFsck.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java index 21e995ddefe..898f3395a9c 100644 --- a/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java +++ b/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java @@ -244,12 +244,14 @@ public class HBaseFsck { // This is special case if a region is left after split hbi.onlyEdits = true; FileStatus[] subDirs = fs.listStatus(regionDir.getPath()); - Path ePath = HLog.getRegionDirRecoveredEditsDir(regionDir.getPath()); - for (FileStatus subDir : subDirs) { - String sdName = subDir.getPath().getName(); - if (!sdName.startsWith(".") && !sdName.equals(ePath.getName())) { - hbi.onlyEdits = false; - break; + if (subDirs != null) { + Path ePath = HLog.getRegionDirRecoveredEditsDir(regionDir.getPath()); + for (FileStatus subDir : subDirs) { + String sdName = subDir.getPath().getName(); + if (!sdName.startsWith(".") && !sdName.equals(ePath.getName())) { + hbi.onlyEdits = false; + break; + } } } } @@ -324,15 +326,16 @@ public class HBaseFsck { * Check consistency of all regions that have been found in previous phases. */ void checkConsistency() throws IOException { - for (HbckInfo hbi : regionInfo.values()) { - doConsistencyCheck(hbi); + for (java.util.Map.Entry e: regionInfo.entrySet()) { + doConsistencyCheck(e.getKey(), e.getValue()); } } /** * Check a single region for consistency and correct deployment. */ - void doConsistencyCheck(HbckInfo hbi) throws IOException { + void doConsistencyCheck(final String key, final HbckInfo hbi) + throws IOException { String descriptiveName = hbi.toString(); boolean inMeta = hbi.metaEntry != null; @@ -366,7 +369,7 @@ public class HBaseFsck { // We shouldn't have record of this region at all then! assert false : "Entry for region with no data"; } else if (!inMeta && !inHdfs && isDeployed) { - errors.reportError("Region " + descriptiveName + " not on HDFS or in META but " + + errors.reportError("Region " + descriptiveName + ", key=" + key + ", not on HDFS or in META but " + "deployed on " + Joiner.on(", ").join(hbi.deployedOn)); } else if (!inMeta && inHdfs && !isDeployed) { errors.reportError("Region " + descriptiveName + " on HDFS, but not listed in META " + @@ -391,7 +394,7 @@ public class HBaseFsck { HBaseFsckRepair.fixUnassigned(this.conf, hbi.metaEntry); } } else if (inMeta && inHdfs && isDeployed && !shouldBeDeployed) { - errors.reportError("Region " + descriptiveName + " has should not be deployed according " + + errors.reportError("Region " + descriptiveName + " should not be deployed according " + "to META, but is deployed on " + Joiner.on(", ").join(hbi.deployedOn)); } else if (inMeta && inHdfs && isMultiplyDeployed) { errors.reportError("Region " + descriptiveName + " is listed in META on region server " + @@ -732,7 +735,7 @@ public class HBaseFsck { } else if (foundRegionDir != null) { return foundRegionDir.getPath().toString(); } else { - return "unknown region on " + Joiner.on(", ").join(deployedOn); + return "UNKNOWN_REGION on " + Joiner.on(", ").join(deployedOn); } } }