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:01:48 UTC
svn commit: r1181359 -
/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/client/HBaseFsck.java
Author: nspiegelberg
Date: Tue Oct 11 02:01:47 2011
New Revision: 1181359
URL: http://svn.apache.org/viewvc?rev=1181359&view=rev
Log:
HBase FSCK: Ignore Non-numeric Directories
Summary:
Ran HBCK on prod cluster & it threw an error for .META./compaction.dir. Layout in
HBase is: /hbase/table/region & region is always a numeric hash. So, we should
ignore directories at the region level that are non-numeric.
Test Plan:
bin/hbase fsck
DiffCamp Revision: 148626
Reviewed By: ageorgiev
CC: nspiegelberg, ageorgiev
Revert Plan:
OK
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=1181359&r1=1181358&r2=1181359&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:01:47 2011
@@ -178,17 +178,21 @@ public class HBaseFsck {
errors.reportError("Version file does not exist in root dir " + rootDir);
}
+ // level 1: <HBASE_DIR>/*
for (FileStatus tableDir : tableDirs) {
String tableName = tableDir.getPath().getName();
+ // ignore hidden files
if (tableName.startsWith(".") &&
!tableName.equals( Bytes.toString(HConstants.META_TABLE_NAME)))
continue;
+ // level 2: <HBASE_DIR>/<table>/*
FileStatus[] regionDirs = fs.listStatus(tableDir.getPath());
for (FileStatus regionDir : regionDirs) {
- String finalComponent = regionDir.getPath().getName();
- if (finalComponent.startsWith(".")) continue;
+ String encodedName = regionDir.getPath().getName();
+
+ // ignore directories that aren't numeric
+ if (!encodedName.matches("^\\d+$")) continue;
- String encodedName = finalComponent;
HbckInfo hbi = getOrCreateInfo(encodedName);
hbi.foundRegionDir = regionDir;
}