/** * Get the archive directory for a given region under the specified table * @param rootDir {@link Path} to the root directory where hbase files are stored (for building * the archive path) * @param tableName name of the table to archive. Cannot be null. * @return {@link Path} to the directory to archive the given region, or <tt>null</tt> if it * should not be archived */ public static Path getRegionArchiveDir(Path rootDir, TableName tableName, String encodedRegionName) { // get the archive directory for a table Path archiveDir = getTableArchivePath(rootDir, tableName); return HRegion.getRegionDir(archiveDir, encodedRegionName); }
/** * Get the archive directory for a given region under the specified table * @param tableName the table name. Cannot be null. * @param regiondir the path to the region directory. Cannot be null. * @return {@link Path} to the directory to archive the given region, or <tt>null</tt> if it * should not be archived */ public static Path getRegionArchiveDir(Path rootDir, TableName tableName, Path regiondir) { // get the archive directory for a table Path archiveDir = getTableArchivePath(rootDir, tableName); // then add on the region path under the archive String encodedRegionName = regiondir.getName(); return HRegion.getRegionDir(archiveDir, encodedRegionName); }
/** * Get the directory to archive a store directory * @param conf {@link Configuration} to read for the archive directory name * @param tableName table name under which the store currently lives * @param regionName region encoded name under which the store currently lives * @param familyName name of the family in the store * @return {@link Path} to the directory to archive the given store or * <tt>null</tt> if it should not be archived */ public static Path getStoreArchivePath(final Configuration conf, final TableName tableName, final String regionName, final String familyName) throws IOException { Path tableArchiveDir = getTableArchivePath(conf, tableName); return HStore.getStoreHomedir(tableArchiveDir, regionName, Bytes.toBytes(familyName)); }
/** * Gets the directory to archive a store directory. * @param conf {@link Configuration} to read for the archive directory name. * @param region parent region information under which the store currently lives * @param family name of the family in the store * @return {@link Path} to the directory to archive the given store or <tt>null</tt> if it should * not be archived */ public static Path getStoreArchivePath(Configuration conf, RegionInfo region, byte[] family) throws IOException { Path rootDir = FSUtils.getRootDir(conf); Path tableArchiveDir = getTableArchivePath(rootDir, region.getTable()); return HStore.getStoreHomedir(tableArchiveDir, region, family); }
@Test public void testGetTableArchivePath() { assertNotNull(HFileArchiveUtil.getTableArchivePath(rootDir, TableName.valueOf(name.getMethodName()))); }
/** * Get the path to the table archive directory based on the configured archive directory. * <p> * Get the path to the table's archive directory. * <p> * Generally of the form: /hbase/.archive/[tablename] * @param tabledir directory of the table to be archived. Cannot be null. * @return {@link Path} to the archive directory for the table */ public static Path getTableArchivePath(Path tabledir) { Path root = tabledir.getParent(); return getTableArchivePath(root, tabledir.getName()); }
/** * Get the archive directory for a given region under the specified table * @param rootDir {@link Path} to the root directory where hbase files are stored (for building * the archive path) * @param tableName name of the table to archive. Cannot be null. * @return {@link Path} to the directory to archive the given region, or <tt>null</tt> if it * should not be archived */ public static Path getRegionArchiveDir(Path rootDir, TableName tableName, String encodedRegionName) { // get the archive directory for a table Path archiveDir = getTableArchivePath(rootDir, tableName); return HRegion.getRegionDir(archiveDir, encodedRegionName); }
/** * Get the directory to archive a store directory * @param conf {@link Configuration} to read for the archive directory name * @param tableName table name under which the store currently lives * @param regionName region encoded name under which the store currently lives * @param family name of the family in the store * @return {@link Path} to the directory to archive the given store or * <tt>null</tt> if it should not be archived */ public static Path getStoreArchivePath(final Configuration conf, final String tableName, final String regionName, final String familyName) throws IOException { Path tableArchiveDir = getTableArchivePath(conf, tableName); return Store.getStoreHomedir(tableArchiveDir, regionName, familyName); }
/** * Get the archive directory for a given region under the specified table * @param rootdir {@link Path} to the root directory where hbase files are stored (for building * the archive path) * @param tabledir the original table directory. Cannot be null. * @param regiondir the path to the region directory. Cannot be null. * @return {@link Path} to the directory to archive the given region, or <tt>null</tt> if it * should not be archived */ public static Path getRegionArchiveDir(Path rootdir, Path tabledir, Path regiondir) { // get the archive directory for a table Path archiveDir = getTableArchivePath(rootdir, tabledir.getName()); // then add on the region path under the archive String encodedRegionName = regiondir.getName(); return HRegion.getRegionDir(archiveDir, encodedRegionName); }
/** * Get the directory to archive a store directory * @param conf {@link Configuration} to read for the archive directory name * @param tableName table name under which the store currently lives * @param regionName region encoded name under which the store currently lives * @param familyName name of the family in the store * @return {@link Path} to the directory to archive the given store or * <tt>null</tt> if it should not be archived */ public static Path getStoreArchivePath(final Configuration conf, final TableName tableName, final String regionName, final String familyName) throws IOException { Path tableArchiveDir = getTableArchivePath(conf, tableName); return HStore.getStoreHomedir(tableArchiveDir, regionName, Bytes.toBytes(familyName)); }
/** * Get the archive directory for a given region under the specified table * @param conf {@link Configuration} to read the archive directory from. Can be null * @param tabledir the original table directory. Cannot be null. * @param regiondir the path to the region directory. Cannot be null. * @return {@link Path} to the directory to archive the given region, or <tt>null</tt> if it * should not be archived */ public static Path getRegionArchiveDir(Configuration conf, Path tabledir, Path regiondir) { // get the archive directory for a table Path archiveDir = getTableArchivePath(tabledir); // then add on the region path under the archive String encodedRegionName = regiondir.getName(); return HRegion.getRegionDir(archiveDir, encodedRegionName); }
/** * Get the archive directory for a given region under the specified table * @param tableName the table name. Cannot be null. * @param regiondir the path to the region directory. Cannot be null. * @return {@link Path} to the directory to archive the given region, or <tt>null</tt> if it * should not be archived */ public static Path getRegionArchiveDir(Path rootDir, TableName tableName, Path regiondir) { // get the archive directory for a table Path archiveDir = getTableArchivePath(rootDir, tableName); // then add on the region path under the archive String encodedRegionName = regiondir.getName(); return HRegion.getRegionDir(archiveDir, encodedRegionName); }
/** * Get the directory to archive a store directory * @param conf {@link Configuration} to read for the archive directory name. Can be null. * @param region parent region information under which the store currently lives * @param tabledir directory for the table under which the store currently lives * @param family name of the family in the store * @return {@link Path} to the directory to archive the given store or <tt>null</tt> if it should * not be archived */ public static Path getStoreArchivePath(Configuration conf, HRegionInfo region, Path tabledir, byte[] family) { Path tableArchiveDir = getTableArchivePath(tabledir); return Store.getStoreHomedir(tableArchiveDir, HRegionInfo.encodeRegionName(region.getRegionName()), family); }
/** * Get the directory to archive a store directory * @param conf {@link Configuration} to read for the archive directory name. * @param region parent region information under which the store currently lives * @param tabledir directory for the table under which the store currently lives * @param family name of the family in the store * @return {@link Path} to the directory to archive the given store or <tt>null</tt> if it should * not be archived */ public static Path getStoreArchivePath(Configuration conf, HRegionInfo region, Path tabledir, byte[] family) throws IOException { TableName tableName = FSUtils.getTableName(tabledir); Path rootDir = FSUtils.getRootDir(conf); Path tableArchiveDir = getTableArchivePath(rootDir, tableName); return HStore.getStoreHomedir(tableArchiveDir, region, family); }
@Test public void testGetTableArchivePath() { assertNotNull(HFileArchiveUtil.getTableArchivePath(rootDir, TableName.valueOf(name.getMethodName()))); }