Author: stack
Date: Sun Sep 18 18:00:30 2011
New Revision: 1172310

URL: http://svn.apache.org/viewvc?rev=1172310&view=rev
Log:
HBASE-4375 [hbck] Add region coverage visualization to hbck

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java

Modified: hbase/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1172310&r1=1172309&r2=1172310&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sun Sep 18 18:00:30 2011
@@ -630,6 +630,8 @@ Release 0.90.5 - Unreleased
                in hbck. (Jonathan Hsieh)
    HBASE-4384  Hard to tell what causes failure in 
CloseRegionHandler#getCurrentVersion
                (Harsh J)
+   HBASE-4375  [hbck] Add region coverage visualization to hbck
+               (Jonathan Hsieh)
 
 Release 0.90.4 - August 10, 2011
 

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java
URL: 
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java?rev=1172310&r1=1172309&r2=1172310&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java 
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java Sun 
Sep 18 18:00:30 2011
@@ -679,9 +679,31 @@ public class HBaseFsck {
         }
         prevKey = key;
       }
+      if (details) {
+        // do full region split map dump
+        dump(sc.getSplits(), regions);
+      }
       return errors.getErrorList().size() == originalErrorsCount;
     }
 
+    /**
+     * This dumps data in a visually reasonable way for visual debugging
+     * 
+     * @param splits
+     * @param regions
+     */
+    void dump(TreeSet<byte[]> splits, Multimap<byte[], HbckInfo> regions) {
+      // we display this way because the last end key should be displayed as 
well.
+      for (byte[] k : splits) {
+        System.out.print(Bytes.toString(k) + ":\t");
+        for (HbckInfo r : regions.get(k)) {
+          System.out.print("[ "+ r.toString() + ", " 
+              + Bytes.toString(r.getEndKey())+ "]\t");
+        }
+        System.out.println();
+      }
+    }
+    
   }
 
   /**


Reply via email to