Index: src/main/java/org/apache/hadoop/hbase/HConstants.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/HConstants.java (revision 4e14cc3d58d5dbf725f31579482182fab3dfe144) +++ src/main/java/org/apache/hadoop/hbase/HConstants.java (revision ) @@ -22,6 +22,10 @@ import org.apache.hadoop.hbase.ipc.HRegionInterface; import org.apache.hadoop.hbase.util.Bytes; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + /** * HConstants holds a bunch of HBase-related constants */ @@ -142,7 +146,7 @@ /** Default value for thread wake frequency */ public static final int DEFAULT_THREAD_WAKE_FREQUENCY = 10 * 1000; - + /** Parameter name for how often a region should should perform a major compaction */ public static final String MAJOR_COMPACTION_PERIOD = "hbase.hregion.majorcompaction"; @@ -456,7 +460,7 @@ * timeout for each RPC */ public static String HBASE_RPC_TIMEOUT_KEY = "hbase.rpc.timeout"; - + /** * Default value of {@link #HBASE_RPC_TIMEOUT_KEY} */ @@ -482,6 +486,10 @@ */ public static final float HBASE_CLUSTER_MINIMUM_MEMORY_THRESHOLD = 0.2f; + public static final List hbaseNonTableDirs = new ArrayList( + Arrays.asList(new String[]{".logs", ".oldlogs", + ".corrupt", ".META.", "-ROOT-"})); + private HConstants() { // Can't be instantiated with this ctor. } Index: src/main/java/org/apache/hadoop/hbase/util/FSUtils.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (date 1308889193000) +++ src/main/java/org/apache/hadoop/hbase/util/FSUtils.java (revision ) @@ -840,7 +840,8 @@ /** * @param fs * @param rootdir - * @return All the table directories under rootdir + * @return All the table directories under rootdir. Ignore non table hbase folders such as + * .logs, .oldlogs, .corrupt, .META., and -ROOT- folders. * @throws IOException */ public static List getTableDirs(final FileSystem fs, final Path rootdir) @@ -851,14 +852,10 @@ for (FileStatus dir: dirs) { Path p = dir.getPath(); String tableName = p.getName(); - if (tableName.equals(HConstants.HREGION_LOGDIR_NAME) || - tableName.equals(Bytes.toString(HConstants.ROOT_TABLE_NAME)) || - tableName.equals(Bytes.toString(HConstants.META_TABLE_NAME)) || - tableName.equals(HConstants.HREGION_OLDLOGDIR_NAME) ) { - continue; - } + if (!HConstants.hbaseNonTableDirs.contains(tableName)) { - tabledirs.add(p); - } + tabledirs.add(p); + } + } return tabledirs; } Index: src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java (date 1308889193000) +++ src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java (revision ) @@ -114,6 +114,11 @@ cachehits++; return HTableDescriptor.META_TABLEDESC; } + // .META. and -ROOT- is already handled. If some one tries to get the descriptor for + // .logs, .oldlogs or .corrupt throw an exception. + if (HConstants.hbaseNonTableDirs.contains(tablename)) { + throw new IOException("No descriptor found for table = " + tablename); + } // Look in cache of descriptors. TableDescriptorModtime tdm = this.cache.get(tablename); @@ -161,6 +166,9 @@ if (Bytes.equals(HConstants.META_TABLE_NAME, htd.getName())) { throw new NotImplementedException(); } + if (HConstants.hbaseNonTableDirs.contains(htd.getNameAsString())) { + throw new NotImplementedException(); + } if (!this.fsreadonly) FSUtils.updateHTableDescriptor(this.fs, this.rootdir, htd); long modtime = FSUtils.getTableInfoModtime(this.fs, this.rootdir, htd.getNameAsString());