You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 04:00:22 UTC
svn commit: r1181342 -
/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java
Author: nspiegelberg
Date: Tue Oct 11 02:00:22 2011
New Revision: 1181342
URL: http://svn.apache.org/viewvc?rev=1181342&view=rev
Log:
HBASE-2876 HBase hbck: false positive error reported for parent regions that are in offline state in meta after a split
Summary:
HBASE-2876 HBase hbck: false positive error reported for parent regions that are in offline state in meta after a split
See discussion in: https://issues.apache.org/jira/browse/HBASE-2876.
Reviewed By:kranganathan
Test Plan:Ran hbck on cluster test and observed it when a region was split; and before the parent row had been reclaimed.
Modified:
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java?rev=1181342&r1=1181341&r2=1181342&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java Tue Oct 11 02:00:22 2011
@@ -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,6 +317,11 @@ public class HBaseFsck extends HBaseAdmi
// all the region left in tmp are not found on any region server
for (MetaEntry metaEntry: tmp.values()) {
+ // 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 " +