public static SnapshotManifest getSnapshotManifest(Configuration conf, String snapshotName, Path rootDir, FileSystem fs) throws IOException { Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir); SnapshotDescription snapshotDesc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir); return SnapshotManifest.open(conf, fs, snapshotDir, snapshotDesc); }
/** * Returns the store file names in the snapshot. * * @param conf The current {@link Configuration} instance. * @param fs {@link FileSystem} * @param snapshotDir {@link Path} to the Snapshot directory * @throws IOException if an error occurred while scanning the directory * @return the names of hfiles in the specified snaphot */ public static Set<String> getHFileNames(final Configuration conf, final FileSystem fs, final Path snapshotDir) throws IOException { SnapshotDescription desc = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir); return getHFileNames(conf, fs, snapshotDir, desc); }
/** * Get the directory for a completed snapshot. This directory is a sub-directory of snapshot root * directory and all the data files for a snapshot are kept under this directory. * @param snapshotName name of the snapshot being taken * @param rootDir hbase root directory * @return the final directory for the completed snapshot */ public static Path getCompletedSnapshotDir(final String snapshotName, final Path rootDir) { return getSpecifiedSnapshotDir(getSnapshotsDir(rootDir), snapshotName); }
private RegionVisitor createRegionVisitor(final SnapshotDescription desc) throws IOException { switch (getSnapshotFormat(desc)) { case SnapshotManifestV1.DESCRIPTOR_VERSION: return new SnapshotManifestV1.ManifestBuilder(conf, rootFs, workingDir); case SnapshotManifestV2.DESCRIPTOR_VERSION: return new SnapshotManifestV2.ManifestBuilder(conf, rootFs, workingDir); default: throw new CorruptedSnapshotException("Invalid Snapshot version: " + desc.getVersion(), ProtobufUtil.createSnapshotDesc(desc)); } }
/** * Get the directory to build a snapshot, before it is finalized * @param snapshotName name of the snapshot * @param rootDir root directory of the hbase installation * @param conf Configuration of the HBase instance * @return {@link Path} where one can build a snapshot */ public static Path getWorkingSnapshotDir(String snapshotName, final Path rootDir, Configuration conf) { return getSpecifiedSnapshotDir(getWorkingSnapshotDir(rootDir, conf), snapshotName); }
private void testExportFileSystemState(final TableName tableName, final byte[] snapshotName, final byte[] targetName, int filesExpected) throws Exception { testExportFileSystemState(tableName, snapshotName, targetName, filesExpected, getHdfsDestinationDir(), false); }
@Override public RecordReader<BytesWritable, NullWritable> createRecordReader(InputSplit split, TaskAttemptContext tac) throws IOException, InterruptedException { return new ExportSnapshotRecordReader(((ExportSnapshotInputSplit)split).getSplitKeys()); }
public void addMobRegion(RegionInfo regionInfo) throws IOException { // Get the ManifestBuilder/RegionVisitor RegionVisitor visitor = createRegionVisitor(desc); // Visit the region and add it to the manifest addMobRegion(regionInfo, visitor); }
@Override protected int countRows(Table table, byte[]... families) throws IOException { return MobSnapshotTestingUtils.countMobRows(table, families); } }
public static void createPreSplitMobTable(final HBaseTestingUtility util, final TableName tableName, int nRegions, final byte[]... families) throws IOException, InterruptedException { createMobTable(util, tableName, SnapshotTestingUtils.getSplitKeys(nRegions), 1, families); }
@Override protected void verifyRowCount(HBaseTestingUtility util, TableName tableName, long expectedRows) throws IOException { MobSnapshotTestingUtils.verifyMobRowCount(util, tableName, expectedRows); }
@Override protected int countRows(final Table table, final byte[]... families) throws IOException { return MobSnapshotTestingUtils.countMobRows(table, families); } }
/** * Create the Mob Table. */ public static void createMobTable(final HBaseTestingUtility util, final TableName tableName, int regionReplication, final byte[]... families) throws IOException, InterruptedException { createMobTable(util, tableName, SnapshotTestingUtils.getSplitKeys(), regionReplication, families); }
@Override protected void verifyRowCount(final HBaseTestingUtility util, final TableName tableName, long expectedRows) throws IOException { MobSnapshotTestingUtils.verifyMobRowCount(util, tableName, expectedRows); }
@Override protected int countRows(final Table table, final byte[]... families) throws IOException { return MobSnapshotTestingUtils.countMobRows(table, families); } }
@Override protected void verifyRowCount(HBaseTestingUtility util, TableName tableName, long expectedRows) throws IOException { MobSnapshotTestingUtils.verifyMobRowCount(util, tableName, expectedRows); }
@Override protected int countRows(Table table, byte[]... families) throws IOException { return MobSnapshotTestingUtils.countMobRows(table, families); } }
@Override protected void verifyRowCount(HBaseTestingUtility util, TableName tableName, long expectedRows) throws IOException { MobSnapshotTestingUtils.verifyMobRowCount(util, tableName, expectedRows); }
@Override protected void verifyRowCount(HBaseTestingUtility util, TableName tableName, long expectedRows) throws IOException { MobSnapshotTestingUtils.verifyMobRowCount(util, tableName, expectedRows); }