hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1374676 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java
Date Sat, 18 Aug 2012 23:34:18 GMT
Author: tedyu
Date: Sat Aug 18 23:34:17 2012
New Revision: 1374676

URL: http://svn.apache.org/viewvc?rev=1374676&view=rev
Log:
HBASE-6608 Fix for HBASE-6160, META entries from daughters can be deleted before parent entries,
shouldn't compare HRegionInfo's (Enis)


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java?rev=1374676&r1=1374675&r2=1374676&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
Sat Aug 18 23:34:17 2012
@@ -153,14 +153,18 @@ class CatalogJanitor extends Chore {
 
       // Now work on our list of found parents. See if any we can clean up.
       int cleaned = 0;
-      HashSet<HRegionInfo> parentNotCleaned = new HashSet<HRegionInfo>(); //regions
whose parents are still around
+    //regions whose parents are still around
+      HashSet<String> parentNotCleaned = new HashSet<String>();
       for (Map.Entry<HRegionInfo, Result> e : splitParents.entrySet()) {
-        if (!parentNotCleaned.contains(e.getKey()) && cleanParent(e.getKey(), e.getValue()))
{
+        if (!parentNotCleaned.contains(e.getKey().getEncodedName()) &&
+            cleanParent(e.getKey(), e.getValue())) {
           cleaned++;
         } else {
-          // We could not clean the parent, so it's daughters should not be cleaned either
(HBASE-6160)
-          parentNotCleaned.add(getDaughterRegionInfo(e.getValue(), HConstants.SPLITA_QUALIFIER));
-          parentNotCleaned.add(getDaughterRegionInfo(e.getValue(), HConstants.SPLITB_QUALIFIER));
+          // We could not clean the parent, so its daughters should not be cleaned either(HBASE-6160)
+          parentNotCleaned.add(
+              getDaughterRegionInfo(e.getValue(), HConstants.SPLITA_QUALIFIER).getEncodedName());
+          parentNotCleaned.add(
+              getDaughterRegionInfo(e.getValue(), HConstants.SPLITB_QUALIFIER).getEncodedName());
         }
       }
       if (cleaned != 0) {

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java?rev=1374676&r1=1374675&r2=1374676&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestCatalogJanitor.java
Sat Aug 18 23:34:17 2012
@@ -542,6 +542,7 @@ public class TestCatalogJanitor {
     final Map<HRegionInfo, Result> splitParents =
         new TreeMap<HRegionInfo, Result>(new SplitParentFirstComparator());
     splitParents.put(parent, makeResultFromHRegionInfo(parent, splita, splitb));
+    splita.setOffline(true); //simulate that splita goes offline when it is split
     splitParents.put(splita, makeResultFromHRegionInfo(splita, splitaa, splitab));
 
     CatalogJanitor janitor = spy(new CatalogJanitor(server, services));



Mime
View raw message