/** * Get the general working directory for snapshots - where they are built, where they are * temporarily copied on export, etc. * @param rootDir root directory of the HBase installation * @param conf Configuration of the HBase instance * @return Path to the snapshot tmp directory, relative to the passed root directory */ public static Path getWorkingSnapshotDir(final Path rootDir, final Configuration conf) { return new Path(conf.get(SNAPSHOT_WORKING_DIR, getDefaultWorkingSnapshotDir(rootDir).toString())); }
/** * Determines if the given workingDir is a subdirectory of the default working snapshot directory * @param workingDir a directory to check * @param conf configuration for the HBase cluster * @return true if the given workingDir is a subdirectory of the default working directory for * snapshots, false otherwise */ public static boolean isWithinDefaultWorkingDir(final Path workingDir, Configuration conf) { Path defaultWorkingDir = getDefaultWorkingSnapshotDir(new Path(conf.get(HConstants.HBASE_DIR))); return workingDir.equals(defaultWorkingDir) || isSubDirectoryOf(workingDir, defaultWorkingDir); }