Java Code Examples for org.apache.hadoop.hbase.HConstants#SNAPSHOT_DIR_NAME

The following examples show how to use org.apache.hadoop.hbase.HConstants#SNAPSHOT_DIR_NAME . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSnapshotDescriptionUtils.java    From hbase with Apache License 2.0 6 votes vote down vote up
/**
 * Test that we throw an exception if there is no working snapshot directory when we attempt to
 * 'complete' the snapshot
 * @throws Exception on failure
 */
@Test
public void testCompleteSnapshotWithNoSnapshotDirectoryFailure() throws Exception {
  Path snapshotDir = new Path(root, HConstants.SNAPSHOT_DIR_NAME);
  Path tmpDir = new Path(snapshotDir, ".tmp");
  Path workingDir = new Path(tmpDir, "not_a_snapshot");
  Configuration conf = new Configuration();
  FileSystem workingFs = workingDir.getFileSystem(conf);
  assertFalse("Already have working snapshot dir: " + workingDir
      + " but shouldn't. Test file leak?", fs.exists(workingDir));
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName("snapshot").build();
  Path finishedDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshot, snapshotDir);

  try {
    SnapshotDescriptionUtils.completeSnapshot(finishedDir, workingDir, fs, workingFs, conf);
    fail("Shouldn't successfully complete move of a non-existent directory.");
  } catch (IOException e) {
    LOG.info("Correctly failed to move non-existant directory: " + e.getMessage());
  }
}
 
Example 2
Source File: SnapshotScannerHDFSAclHelper.java    From hbase with Apache License 2.0 5 votes vote down vote up
PathHelper(Configuration conf) {
  this.conf = conf;
  rootDir = new Path(conf.get(HConstants.HBASE_DIR));
  tmpDataDir = new Path(new Path(rootDir, HConstants.HBASE_TEMP_DIRECTORY),
      HConstants.BASE_NAMESPACE_DIR);
  dataDir = new Path(rootDir, HConstants.BASE_NAMESPACE_DIR);
  mobDataDir = new Path(MobUtils.getMobHome(rootDir), HConstants.BASE_NAMESPACE_DIR);
  archiveDataDir = new Path(new Path(rootDir, HConstants.HFILE_ARCHIVE_DIRECTORY),
      HConstants.BASE_NAMESPACE_DIR);
  snapshotDir = new Path(rootDir, HConstants.SNAPSHOT_DIR_NAME);
}
 
Example 3
Source File: RestoreTool.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * Returns value represent path for path to backup table snapshot directory:
 * "/$USER/SBACKUP_ROOT/backup_id/namespace/table/.hbase-snapshot"
 * @param backupRootPath backup root path
 * @param tableName table name
 * @param backupId backup Id
 * @return path for snapshot
 */
Path getTableSnapshotPath(Path backupRootPath, TableName tableName, String backupId) {
  return new Path(HBackupFileSystem.getTableBackupPath(tableName, backupRootPath, backupId),
      HConstants.SNAPSHOT_DIR_NAME);
}
 
Example 4
Source File: SnapshotDescriptionUtils.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * Get the snapshot root directory. All the snapshots are kept under this directory, i.e.
 * ${hbase.rootdir}/.snapshot
 * @param rootDir hbase root directory
 * @return the base directory in which all snapshots are kept
 */
public static Path getSnapshotRootDir(final Path rootDir) {
  return new Path(rootDir, HConstants.SNAPSHOT_DIR_NAME);
}
 
Example 5
Source File: SnapshotDescriptionUtils.java    From hbase with Apache License 2.0 2 votes vote down vote up
/**
 * @param rootDir hbase root directory
 * @return the directory for all completed snapshots;
 */
public static final Path getSnapshotsDir(Path rootDir) {
  return new Path(rootDir, HConstants.SNAPSHOT_DIR_NAME);
}