You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2011/07/24 05:57:56 UTC

svn commit: r1150278 - in /hbase/branches/0.90: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java

Author: stack
Date: Sun Jul 24 03:57:56 2011
New Revision: 1150278

URL: http://svn.apache.org/viewvc?rev=1150278&view=rev
Log:
HBASE-4129 hbase-3872 added a warn message 'CatalogJanitor: Daughter regiondir does not exist' that is triggered though its often legit that daughter is not present

Modified:
    hbase/branches/0.90/CHANGES.txt
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1150278&r1=1150277&r2=1150278&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Sun Jul 24 03:57:56 2011
@@ -87,6 +87,9 @@ Release 0.90.4 - Unreleased
                Content-Encoding: gzip in parallel
    HBASE-4116  [stargate] StringIndexOutOfBoundsException in row spec parse
                (Allan Yan)
+   HBASE-4129  HBASE-3872 added a warn message 'CatalogJanitor: Daughter regiondir
+               does not exist' that is triggered though its often legit that daughter
+               is not present
 
   IMPROVEMENT
    HBASE-3882  hbase-config.sh needs to be updated so it can auto-detects the

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java?rev=1150278&r1=1150277&r2=1150278&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java Sun Jul 24 03:57:56 2011
@@ -20,6 +20,7 @@
 package org.apache.hadoop.hbase.master;
 
 import java.io.IOException;
+import java.util.Comparator;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -41,6 +42,7 @@ import org.apache.hadoop.hbase.client.Re
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.regionserver.Store;
 import org.apache.hadoop.hbase.regionserver.StoreFile;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.util.Writables;
 
@@ -98,8 +100,28 @@ class CatalogJanitor extends Chore {
     // TODO: Only works with single .META. region currently.  Fix.
     final AtomicInteger count = new AtomicInteger(0);
     // Keep Map of found split parents.  There are candidates for cleanup.
+    // Use a comparator that has split parents come before its daughters.
     final Map<HRegionInfo, Result> splitParents =
-      new TreeMap<HRegionInfo, Result>();
+      new TreeMap<HRegionInfo, Result>(new Comparator<HRegionInfo> () {
+        @Override
+        public int compare(HRegionInfo left, HRegionInfo right) {
+          // This comparator differs from the one HRegionInfo in that it sorts
+          // parent before daughters.
+          if (left == null) return -1;
+          if (right == null) return 1;
+          // Same table name.
+          int result = Bytes.compareTo(left.getTableDesc().getName(),
+            right.getTableDesc().getName());
+          if (result != 0) return result;
+          // Compare start keys.
+          result = Bytes.compareTo(left.getStartKey(), right.getStartKey());
+          if (result != 0) return result;
+          // Compare end keys.
+          result = Bytes.compareTo(left.getEndKey(), right.getEndKey());
+          if (result != 0) return -result; // Flip the result so parent comes first.
+          return result;
+        }
+      });
     // This visitor collects split parents and counts rows in the .META. table
     MetaReader.Visitor visitor = new MetaReader.Visitor() {
       @Override
@@ -248,9 +270,7 @@ class CatalogJanitor extends Chore {
 
   /**
    * Checks if a daughter region -- either splitA or splitB -- still holds
-   * references to parent.  If not, removes reference to the split from
-   * the parent meta region row so we don't check it any more.  Also checks
-   * daughter region exists in the filesytem.
+   * references to parent.
    * @param parent Parent region name. 
    * @param rowContent Keyed content of the parent row in meta region.
    * @param split Which column family.