Author: stack
Date: Sun Jul 24 04:03:21 2011
New Revision: 1150280
URL: http://svn.apache.org/viewvc?rev=1150280&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/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
Modified: hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1150280&r1=1150279&r2=1150280&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sun Jul 24 04:03:21 2011
@@ -429,6 +429,9 @@ Release 0.90.4 - Unreleased
HBASE-4115 HBase shell assign and unassign unusable if region name
includes binary-encoded data (Ryan Brush)
HBASE-4126 Make timeoutmonitor timeout after 30 minutes instead of 3
+ 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/trunk/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java?rev=1150280&r1=1150279&r2=1150280&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/CatalogJanitor.java
Sun Jul 24 04:03:21 2011
@@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.master;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -44,6 +45,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.Bytes;
import org.apache.hadoop.hbase.util.Writables;
@@ -103,8 +105,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
@@ -253,9 +275,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.