Index: hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java =================================================================== --- hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java (revision 1505764) +++ hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java (working copy) @@ -158,7 +158,9 @@ if (cachedtdm != null) { // Check mod time has not changed (this is trip to NN). - if (getTableInfoModtime(this.fs, this.rootdir, tablename) <= cachedtdm.getModtime()) { + // Try the table dir's mod time dirs in order to avoid listing all directories. + if (getTableDirModtime(this.fs, this.rootdir, tablename) <= cachedtdm.getModtime() + || getTableInfoModtime(this.fs, this.rootdir, tablename) <= cachedtdm.getModtime()) { cachehits++; return cachedtdm.getTableDescriptor(); } @@ -376,6 +378,18 @@ } /** + * @param fs + * @param rootdir + * @param tableName + * @return Modification time for the table directory + * @throws IOException + */ + static long getTableDirModtime(final FileSystem fs, final Path rootdir, final String tableName) + throws IOException { + return fs.getFileStatus(FSUtils.getTablePath(rootdir, tableName)).getModificationTime(); + } + + /** * Get HTD from HDFS. * @param fs * @param hbaseRootDir