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
This commit is contained in:
Michael Stack 2010-07-25 03:45:26 +00:00
parent e258c33f78
commit 04bf6f48e4
2 changed files with 34 additions and 42 deletions

View File

@ -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

View File

@ -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<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 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);