From 04bf6f48e469872e0cf59725a019968d61ce3e6a Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Sun, 25 Jul 2010 03:45:26 +0000 Subject: [PATCH] HBASE-2876 HBase hbck: false positive error reported for parent regions that are in offline state in meta after a split git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@978971 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 + .../apache/hadoop/hbase/client/HBaseFsck.java | 74 ++++++++----------- 2 files changed, 34 insertions(+), 42 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 56512668c46..953c79576e4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java b/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java index 4e1bb599a55..751e308efe3 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java +++ b/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java @@ -19,51 +19,35 @@ */ package org.apache.hadoop.hbase.client; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.conf.Configuration; -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.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.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.HConstants; +import org.apache.hadoop.hbase.HRegionInfo; +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.client.MetaScanner.MetaScannerVisitor; +import org.apache.hadoop.hbase.ipc.HMasterInterface; +import org.apache.hadoop.hbase.ipc.HRegionInterface; +import org.apache.hadoop.hbase.util.Bytes; +import org.apache.hadoop.hbase.util.Writables; + /** * Check consistency among the in-memory states of the master and the * region server(s) and the state of data in HDFS. @@ -264,12 +248,13 @@ public class HBaseFsck extends HBaseAdmin { throws IOException { // make a copy of all entries in META - TreeMap tmp = new TreeMap(metaEntries); + TreeMap tmp = + new TreeMap(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 HBaseAdmin { } // 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 HBaseAdmin { // 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);