@Test public void testReadingArchiveDirectoryFromFS() throws IOException { FileSystem fs = FileSystem.get(UTIL.getConfiguration()); try { new FSTableDescriptors(fs, FSUtils.getRootDir(UTIL.getConfiguration())) .get(TableName.valueOf(HConstants.HFILE_ARCHIVE_DIRECTORY)); fail("Shouldn't be able to read a table descriptor for the archive directory."); } catch (Exception e) { LOG.debug("Correctly got error when reading a table descriptor from the archive directory: " + e.getMessage()); } }
@Override public HTableDescriptor get(final TableName tablename) throws IOException { invocations++; if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tablename)) { cachehits++; return HTableDescriptor.META_TABLEDESC; } if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tablename.getNameAsString())) { throw new IOException("No descriptor found for non table = " + tablename); } TableDescriptorAndModtime cachedtdm = this.cache.get(tablename); if (cachedtdm != null) { if (getTableInfoModtime(tablename) <= cachedtdm.getModtime()) { cachehits++; return cachedtdm.getTableDescriptor(); } } TableDescriptorAndModtime tdmt = null; try { tdmt = getTableDescriptorAndModtime(tablename); } catch (NullPointerException e) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, e); } catch (IOException ioe) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, ioe); } if (tdmt != null) { this.cache.put(tablename, tdmt); } return tdmt == null ? null : tdmt.getTableDescriptor(); }
FSTableDescriptors implements TableDescriptors { @Override public HTableDescriptor get(final TableName tablename) throws IOException { invocations++; if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tablename)) { cachehits++; return HTableDescriptor.META_TABLEDESC; } if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tablename.getNameAsString())) { throw new IOException("No descriptor found for non table = " + tablename); } TableDescriptorAndModtime cachedtdm = this.cache.get(tablename); if (cachedtdm != null) { if (getTableInfoModtime(tablename) <= cachedtdm.getModtime()) { cachehits++; return cachedtdm.getTableDescriptor(); } } TableDescriptorAndModtime tdmt = null; try { tdmt = getTableDescriptorAndModtime(tablename); } catch (NullPointerException e) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, e); } catch (IOException ioe) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, ioe); } if (tdmt != null) { this.cache.put(tablename, tdmt); } return tdmt == null ? null : tdmt.getTableDescriptor(); } }
FSTableDescriptors implements TableDescriptors { @Override public HTableDescriptor get(final TableName tablename) throws IOException { invocations++; if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tablename)) { cachehits++; return HTableDescriptor.META_TABLEDESC; } if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tablename.getNameAsString())) { throw new IOException("No descriptor found for non table = " + tablename); } TableDescriptorAndModtime cachedtdm = this.cache.get(tablename); if (cachedtdm != null) { if (getTableInfoModtime(tablename) <= cachedtdm.getModtime()) { cachehits++; return cachedtdm.getTableDescriptor(); } } TableDescriptorAndModtime tdmt = null; try { tdmt = getTableDescriptorAndModtime(tablename); } catch (NullPointerException e) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, e); } catch (IOException ioe) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, ioe); } if (tdmt != null) { this.cache.put(tablename, tdmt); } return tdmt == null ? null : tdmt.getTableDescriptor(); } FSTableDescriptors(final Configuration conf);  FSTableDescriptors(final FileSystem fs, final Path rootdir);  FSTableDescriptors(final FileSystem fs,
      final Path rootdir, final boolean fsreadonly); }
FSTableDescriptors implements TableDescriptors { @Override public HTableDescriptor get(final TableName tablename) throws IOException { invocations++; if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tablename)) { cachehits++; return HTableDescriptor.META_TABLEDESC; } if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tablename.getNameAsString())) { throw new IOException("No descriptor found for non table = " + tablename); } TableDescriptorAndModtime cachedtdm = this.cache.get(tablename); if (cachedtdm != null) { if (getTableInfoModtime(tablename) <= cachedtdm.getModtime()) { cachehits++; return cachedtdm.getTableDescriptor(); } } TableDescriptorAndModtime tdmt = null; try { tdmt = getTableDescriptorAndModtime(tablename); } catch (NullPointerException e) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, e); } catch (IOException ioe) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, ioe); } if (tdmt != null) { this.cache.put(tablename, tdmt); } return tdmt == null ? null : tdmt.getTableDescriptor(); } FSTableDescriptors(final Configuration conf);  FSTableDescriptors(final FileSystem fs, final Path rootdir);  FSTableDescriptors(final FileSystem fs,
      final Path rootdir, final boolean fsreadonly); @Override HTableDescriptor get(final TableName tablename); @Override Map<String, HTableDescriptor> getAll(); @Override Map<String, HTableDescriptor> getByNamespace(String name); @Override void add(HTableDescriptor htd); @Override HTableDescriptor remove(final TableName tablename); boolean isTableInfoExists(TableName tableName); static FileStatus getTableInfoPath(FileSystem fs, Path tableDir); static HTableDescriptor getTableDescriptorFromFs(FileSystem fs,
      Path hbaseRootDir, TableName tableName); static HTableDescriptor getTableDescriptorFromFs(FileSystem fs, Path tableDir); void deleteTableDescriptorIfExists(TableName tableName); boolean createTableDescriptor(HTableDescriptor htd); boolean createTableDescriptor(HTableDescriptor htd, boolean forceCreation); boolean createTableDescriptorForTableDirectory(Path tableDir,
      HTableDescriptor htd, boolean forceCreation); }
FSTableDescriptors implements TableDescriptors { @Override public HTableDescriptor get(final TableName tablename) throws IOException { invocations++; if (HTableDescriptor.META_TABLEDESC.getTableName().equals(tablename)) { cachehits++; return HTableDescriptor.META_TABLEDESC; } if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tablename.getNameAsString())) { throw new IOException("No descriptor found for non table = " + tablename); } TableDescriptorAndModtime cachedtdm = this.cache.get(tablename); if (cachedtdm != null) { if (getTableInfoModtime(tablename) <= cachedtdm.getModtime()) { cachehits++; return cachedtdm.getTableDescriptor(); } } TableDescriptorAndModtime tdmt = null; try { tdmt = getTableDescriptorAndModtime(tablename); } catch (NullPointerException e) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, e); } catch (IOException ioe) { LOG.debug("Exception during readTableDecriptor. Current table name = " + tablename, ioe); } if (tdmt != null) { this.cache.put(tablename, tdmt); } return tdmt == null ? null : tdmt.getTableDescriptor(); } FSTableDescriptors(final Configuration conf);  FSTableDescriptors(final FileSystem fs, final Path rootdir);  FSTableDescriptors(final FileSystem fs,
      final Path rootdir, final boolean fsreadonly); @Override HTableDescriptor get(final TableName tablename); @Override Map<String, HTableDescriptor> getAll(); @Override Map<String, HTableDescriptor> getByNamespace(String name); @Override void add(HTableDescriptor htd); @Override HTableDescriptor remove(final TableName tablename); boolean isTableInfoExists(TableName tableName); static FileStatus getTableInfoPath(FileSystem fs, Path tableDir); static HTableDescriptor getTableDescriptorFromFs(FileSystem fs,
      Path hbaseRootDir, TableName tableName); static HTableDescriptor getTableDescriptorFromFs(FileSystem fs, Path tableDir); void deleteTableDescriptorIfExists(TableName tableName); boolean createTableDescriptor(HTableDescriptor htd); boolean createTableDescriptor(HTableDescriptor htd, boolean forceCreation); boolean createTableDescriptorForTableDirectory(Path tableDir,
      HTableDescriptor htd, boolean forceCreation);  }