/** * @return all the HFiles for a given table in the specified dir * @throws IOException on expected failure */ private final Collection<String> getHFiles(Path dir, FileSystem fs, TableName tableName) throws IOException { Path tableDir = FSUtils.getTableDir(dir, tableName); return SnapshotTestingUtils.listHFileNames(fs, tableDir); }
private void verifyRestore(final Path rootDir, final TableDescriptor sourceHtd, final TableDescriptor htdClone) throws IOException { List<String> files = SnapshotTestingUtils.listHFileNames(fs, FSUtils.getTableDir(rootDir, htdClone.getTableName())); assertEquals(12, files.size()); for (int i = 0; i < files.size(); i += 2) { String linkFile = files.get(i); String refFile = files.get(i+1); assertTrue(linkFile + " should be a HFileLink", HFileLink.isHFileLink(linkFile)); assertTrue(refFile + " should be a Referene", StoreFileInfo.isReference(refFile)); assertEquals(sourceHtd.getTableName(), HFileLink.getReferencedTableName(linkFile)); Path refPath = getReferredToFile(refFile); LOG.debug("get reference name for file " + refFile + " = " + refPath); assertTrue(refPath.getName() + " should be a HFileLink", HFileLink.isHFileLink(refPath.getName())); assertEquals(linkFile, refPath.getName()); } }
@Test public void testFlushWithTableCompactionDisabled() throws Exception { HTableDescriptor htd = new HTableDescriptor(tableName); htd.setCompactionEnabled(false); TEST_UTIL.createTable(htd, new byte[][] { family }, null); // load the table for (int i = 0; i < blockingStoreFiles + 1; i ++) { TEST_UTIL.loadTable(TEST_UTIL.getConnection().getTable(tableName), family); TEST_UTIL.flush(tableName); } // Make sure that store file number is greater than blockingStoreFiles + 1 Path tableDir = FSUtils.getTableDir(rootDir, tableName); Collection<String> hfiles = SnapshotTestingUtils.listHFileNames(fs, tableDir); assert(hfiles.size() > blockingStoreFiles + 1); } }
/** * @return all the HFiles for a given table in the specified dir * @throws IOException on expected failure */ private final Collection<String> getHFiles(Path dir, FileSystem fs, TableName tableName) throws IOException { Path tableDir = FSUtils.getTableDir(dir, tableName); return SnapshotTestingUtils.listHFileNames(fs, tableDir); }
private void verifyRestore(final Path rootDir, final TableDescriptor sourceHtd, final TableDescriptor htdClone) throws IOException { List<String> files = SnapshotTestingUtils.listHFileNames(fs, FSUtils.getTableDir(rootDir, htdClone.getTableName())); assertEquals(12, files.size()); for (int i = 0; i < files.size(); i += 2) { String linkFile = files.get(i); String refFile = files.get(i+1); assertTrue(linkFile + " should be a HFileLink", HFileLink.isHFileLink(linkFile)); assertTrue(refFile + " should be a Referene", StoreFileInfo.isReference(refFile)); assertEquals(sourceHtd.getTableName(), HFileLink.getReferencedTableName(linkFile)); Path refPath = getReferredToFile(refFile); LOG.debug("get reference name for file " + refFile + " = " + refPath); assertTrue(refPath.getName() + " should be a HFileLink", HFileLink.isHFileLink(refPath.getName())); assertEquals(linkFile, refPath.getName()); } }
@Test public void testFlushWithTableCompactionDisabled() throws Exception { HTableDescriptor htd = new HTableDescriptor(tableName); htd.setCompactionEnabled(false); TEST_UTIL.createTable(htd, new byte[][] { family }, null); // load the table for (int i = 0; i < blockingStoreFiles + 1; i ++) { TEST_UTIL.loadTable(TEST_UTIL.getConnection().getTable(tableName), family); TEST_UTIL.flush(tableName); } // Make sure that store file number is greater than blockingStoreFiles + 1 Path tableDir = FSUtils.getTableDir(rootDir, tableName); Collection<String> hfiles = SnapshotTestingUtils.listHFileNames(fs, tableDir); assert(hfiles.size() > blockingStoreFiles + 1); } }