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 2010/07/25 05:45:27 UTC

svn commit: r978971 - in /hbase/trunk: CHANGES.txt src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java

Author: stack
Date: Sun Jul 25 03:45:26 2010
New Revision: 978971

URL: http://svn.apache.org/viewvc?rev=978971&view=rev
Log:
HBASE-2876 HBase hbck: false positive error reported for parent regions that are in offline state in meta after a split

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

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=978971&r1=978970&r2=978971&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sun Jul 25 03:45:26 2010
@@ -452,6 +452,8 @@ Release 0.21.0 - Unreleased
    HBASE-2866  Region permanently offlined
    HBASE-2849  HBase clients cannot recover when their ZooKeeper session
                becomes invalid (Benôit Sigoure via Stack)
+   HBASE-2876  HBase hbck: false positive error reported for parent regions
+               that are in offline state in meta after a split
 
   IMPROVEMENTS
    HBASE-1760  Cleanup TODOs in HTable

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java?rev=978971&r1=978970&r2=978971&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java Sun Jul 25 03:45:26 2010
@@ -19,50 +19,34 @@
  */
 package org.apache.hadoop.hbase.client;
 
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.TreeMap;
+import java.util.TreeSet;
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.ClusterStatus;
 import org.apache.hadoop.hbase.HBaseConfiguration;
-import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
-import org.apache.hadoop.hbase.HRegionLocation;
+import org.apache.hadoop.hbase.HServerAddress;
+import org.apache.hadoop.hbase.HServerInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.MasterNotRunningException;
-import org.apache.hadoop.hbase.HServerInfo;
-import org.apache.hadoop.hbase.HServerAddress;
-import org.apache.hadoop.hbase.RegionException;
-import org.apache.hadoop.hbase.RemoteExceptionHandler;
-import org.apache.hadoop.hbase.TableExistsException;
 import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor;
-import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
 import org.apache.hadoop.hbase.ipc.HMasterInterface;
 import org.apache.hadoop.hbase.ipc.HRegionInterface;
-import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.apache.hadoop.hbase.util.MetaUtils;
 import org.apache.hadoop.hbase.util.Writables;
-import org.apache.hadoop.io.BooleanWritable;
-import org.apache.hadoop.io.Writable;
-import org.apache.hadoop.ipc.RemoteException;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.FileStatus;
-import org.apache.hadoop.fs.Path;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Map;
-import java.util.List;
-import java.util.TreeSet;
-import java.util.TreeMap;
-import java.util.NavigableMap;
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicInteger;
 
 /**
  * Check consistency among the in-memory states of the master and the 
@@ -264,12 +248,13 @@ public class HBaseFsck extends HBaseAdmi
     throws IOException {
 
     // make a copy of all entries in META
-    TreeMap<HRegionInfo, MetaEntry> tmp = new TreeMap<HRegionInfo, MetaEntry>(metaEntries);
+    TreeMap<HRegionInfo, MetaEntry> tmp =
+      new TreeMap<HRegionInfo, MetaEntry>(metaEntries);
     long errorCount = 0; // number of inconsistencies detected
     int showProgress = 0;
 
     // loop to contact each region server
-    for (HServerInfo rsinfo:regionServerList) {
+    for (HServerInfo rsinfo: regionServerList) {
       showProgress++;                   // one more server.
       try {
         HRegionInterface server = connection.getHRegionConnection(
@@ -291,7 +276,7 @@ public class HBaseFsck extends HBaseAdmi
         }
 
         // check to see if the existance of this region matches the region in META
-        for (HRegionInfo r:regions) {
+        for (HRegionInfo r: regions) {
           MetaEntry metaEntry = metaEntries.get(r);
 
           // this entry exists in the region server but is not in the META
@@ -332,7 +317,12 @@ public class HBaseFsck extends HBaseAdmi
 
     // all the region left in tmp are not found on any region server
     for (MetaEntry metaEntry: tmp.values()) {
-      System.out.print("\nERROR: Region " + metaEntry.getRegionNameAsString() + 
+      // An offlined region will not be present out on a regionserver.  A region
+      // is offlined if table is offlined -- will still have an entry in .META.
+      // of a region is offlined because its a parent region and its daughters
+      // still have references.
+      if (metaEntry.isOffline()) continue;
+      System.out.print("\nERROR: Region " + metaEntry.getRegionNameAsString() +
                          " is not served by any region server " +
                          " but is listed in META to be on server " + 
                          metaEntry.regionServer);