HBASE-3201 Add accounting of empty regioninfo_qualifier rows in meta to hbasefsck.

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1031801 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-11-05 21:23:32 +00:00
parent 44eab92141
commit 70091702c5
3 changed files with 24 additions and 6 deletions

View File

@ -1105,6 +1105,8 @@ Release 0.21.0 - Unreleased
HBASE-2819 hbck should have the ability to repair basic problems HBASE-2819 hbck should have the ability to repair basic problems
HBASE-3200 Make is so can disable DEBUG logging on HConnectionImplemenation HBASE-3200 Make is so can disable DEBUG logging on HConnectionImplemenation
without losing important messages without losing important messages
HBASE-3201 Add accounting of empty regioninfo_qualifier rows in meta to
hbasefsck.
NEW FEATURES NEW FEATURES
HBASE-1961 HBase EC2 scripts HBASE-1961 HBase EC2 scripts

View File

@ -506,6 +506,7 @@ public class MetaReader {
if (result != null && result.size() > 0) { if (result != null && result.size() > 0) {
Pair<HRegionInfo, HServerInfo> pair = Pair<HRegionInfo, HServerInfo> pair =
metaRowToRegionPairWithInfo(result); metaRowToRegionPairWithInfo(result);
if (pair == null) continue;
if (pair.getSecond() == null || !pair.getSecond().equals(hsi)) { if (pair.getSecond() == null || !pair.getSecond().equals(hsi)) {
continue; continue;
} }

View File

@ -46,6 +46,7 @@ import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.MasterNotRunningException; import org.apache.hadoop.hbase.MasterNotRunningException;
import org.apache.hadoop.hbase.ZooKeeperConnectionException; import org.apache.hadoop.hbase.ZooKeeperConnectionException;
import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor; import org.apache.hadoop.hbase.client.MetaScanner.MetaScannerVisitor;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.ipc.HRegionInterface; import org.apache.hadoop.hbase.ipc.HRegionInterface;
import org.apache.hadoop.hbase.regionserver.wal.HLog; import org.apache.hadoop.hbase.regionserver.wal.HLog;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
@ -76,6 +77,8 @@ public class HBaseFsck {
private boolean fix = false; // do we want to try fixing the errors? private boolean fix = false; // do we want to try fixing the errors?
private boolean rerun = false; // if we tried to fix something rerun hbck private boolean rerun = false; // if we tried to fix something rerun hbck
private static boolean summary = false; // if we want to print less output private static boolean summary = false; // if we want to print less output
// Empty regioninfo qualifiers in .META.
private TreeSet<Result> emptyRegionInfoQualifiers = new TreeSet<Result>();
/** /**
* Constructor * Constructor
@ -105,6 +108,8 @@ public class HBaseFsck {
// Make sure regionInfo is empty before starting // Make sure regionInfo is empty before starting
regionInfo.clear(); regionInfo.clear();
tablesInfo.clear(); tablesInfo.clear();
emptyRegionInfoQualifiers.clear();
// get a list of all regions from the master. This involves // get a list of all regions from the master. This involves
// scanning the META table // scanning the META table
@ -166,6 +171,15 @@ public class HBaseFsck {
// Determine what's on HDFS // Determine what's on HDFS
checkHdfs(); checkHdfs();
// Empty cells in .META.?
errors.print("Number of empty REGIONINFO_QUALIFIER rows in .META.: " +
emptyRegionInfoQualifiers.size());
if (details) {
for (Result r: emptyRegionInfoQualifiers) {
errors.print(" " + r);
}
}
// Check consistency // Check consistency
checkConsistency(); checkConsistency();
@ -628,12 +642,13 @@ public class HBaseFsck {
// record region details // record region details
byte [] value = result.getValue(HConstants.CATALOG_FAMILY, byte [] value = result.getValue(HConstants.CATALOG_FAMILY,
HConstants.REGIONINFO_QUALIFIER); HConstants.REGIONINFO_QUALIFIER);
HRegionInfo info = null; if (value == null || value.length == 0) {
emptyRegionInfoQualifiers.add(result);
return true;
}
HRegionInfo info = Writables.getHRegionInfo(value);
HServerAddress server = null; HServerAddress server = null;
byte[] startCode = null; byte[] startCode = null;
if (value != null) {
info = Writables.getHRegionInfo(value);
}
// record assigned region server // record assigned region server
value = result.getValue(HConstants.CATALOG_FAMILY, value = result.getValue(HConstants.CATALOG_FAMILY,