Package org.apache.hadoop.hbase.snapshot

Examples of org.apache.hadoop.hbase.snapshot.HSnapshotDescription


   * @throws SnapshotCreationException if snapshot failed to be taken
   * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
   */
  public void snapshot(SnapshotDescription snapshot) throws IOException, SnapshotCreationException,
      IllegalArgumentException {
    HSnapshotDescription snapshotWritable = new HSnapshotDescription(snapshot);

    try {
      // actually take the snapshot
      long max = takeSnapshotAsync(snapshot);
      long start = EnvironmentEdgeManager.currentTimeMillis();
View Full Code Here


   * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
   */
  public long takeSnapshotAsync(SnapshotDescription snapshot) throws IOException,
      SnapshotCreationException {
    SnapshotDescriptionUtils.assertSnapshotRequestIsValid(snapshot);
    HSnapshotDescription snapshotWritable = new HSnapshotDescription(snapshot);
    return getMaster().snapshot(snapshotWritable);
  }
View Full Code Here

   * @throws UnknownSnapshotException if the requested snapshot is unknown
   */
  public boolean isSnapshotFinished(final SnapshotDescription snapshot)
      throws IOException, HBaseSnapshotException, UnknownSnapshotException {
    try {
      return getMaster().isSnapshotDone(new HSnapshotDescription(snapshot));
    } catch (RemoteException e) {
      throw RemoteExceptionHandler.decodeRemoteException(e);
    }
  }
View Full Code Here

   * @throws RestoreSnapshotException if snapshot failed to be restored
   * @throws IllegalArgumentException if the restore request is formatted incorrectly
   */
  private void internalRestoreSnapshot(final String snapshotName, final String tableName)
      throws IOException, RestoreSnapshotException {
    HSnapshotDescription snapshot = new HSnapshotDescription(
      SnapshotDescription.newBuilder().setName(snapshotName).setTable(tableName).build());

    try {
      // actually restore the snapshot
      getMaster().restoreSnapshot(snapshot);

      final long maxPauseTime = 5000;
      boolean done = false;
      int tries = 0;
      while (!done) {
        try {
          // sleep a backoff <= pauseTime amount
          long sleep = getPauseTime(tries++);
          sleep = sleep > maxPauseTime ? maxPauseTime : sleep;
          LOG.debug(tries + ") Sleeping: " + sleep + " ms while we wait for snapshot restore to complete.");
          Thread.sleep(sleep);
        } catch (InterruptedException e) {
          LOG.debug("Interrupted while waiting for snapshot " + snapshot + " restore to complete");
          Thread.currentThread().interrupt();
        }
        LOG.debug("Getting current status of snapshot restore from master...");
        done = getMaster().isRestoreSnapshotDone(snapshot);
      }
      if (!done) {
        throw new RestoreSnapshotException("Snapshot '" + snapshot.getName() + "' wasn't restored.");
      }
    } catch (RemoteException e) {
      throw RemoteExceptionHandler.decodeRemoteException(e);
    }
  }
View Full Code Here

    HTableDescriptor.isLegalTableName(snapshotName, true);
    // do the delete
    SnapshotDescription snapshot = SnapshotDescription.newBuilder()
      .setName(Bytes.toString(snapshotName)).build();
    try {
      getMaster().deleteSnapshot(new HSnapshotDescription(snapshot));
    } catch (RemoteException e) {
      throw RemoteExceptionHandler.decodeRemoteException(e);
    }
  }
View Full Code Here

   * @throws SnapshotCreationException if snapshot failed to be taken
   * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
   */
  public void snapshot(SnapshotDescription snapshot) throws IOException, SnapshotCreationException,
      IllegalArgumentException {
    HSnapshotDescription snapshotWritable = new HSnapshotDescription(snapshot);

    try {
      // actually take the snapshot
      long max = takeSnapshotAsync(snapshot);
      long start = EnvironmentEdgeManager.currentTimeMillis();
View Full Code Here

   * @throws IllegalArgumentException if the snapshot request is formatted incorrectly
   */
  public long takeSnapshotAsync(SnapshotDescription snapshot) throws IOException,
      SnapshotCreationException {
    SnapshotDescriptionUtils.assertSnapshotRequestIsValid(snapshot);
    HSnapshotDescription snapshotWritable = new HSnapshotDescription(snapshot);
    return getMaster().snapshot(snapshotWritable);
  }
View Full Code Here

   * @throws UnknownSnapshotException if the requested snapshot is unknown
   */
  public boolean isSnapshotFinished(final SnapshotDescription snapshot)
      throws IOException, HBaseSnapshotException, UnknownSnapshotException {
    try {
      return getMaster().isSnapshotDone(new HSnapshotDescription(snapshot));
    } catch (RemoteException e) {
      throw RemoteExceptionHandler.decodeRemoteException(e);
    }
  }
View Full Code Here

   * @throws RestoreSnapshotException if snapshot failed to be restored
   * @throws IllegalArgumentException if the restore request is formatted incorrectly
   */
  private void internalRestoreSnapshot(final String snapshotName, final String tableName)
      throws IOException, RestoreSnapshotException {
    HSnapshotDescription snapshot = new HSnapshotDescription(
      SnapshotDescription.newBuilder().setName(snapshotName).setTable(tableName).build());

    try {
      // actually restore the snapshot
      getMaster().restoreSnapshot(snapshot);

      final long maxPauseTime = 5000;
      boolean done = false;
      int tries = 0;
      while (!done) {
        try {
          // sleep a backoff <= pauseTime amount
          long sleep = getPauseTime(tries++);
          sleep = sleep > maxPauseTime ? maxPauseTime : sleep;
          LOG.debug(tries + ") Sleeping: " + sleep + " ms while we wait for snapshot restore to complete.");
          Thread.sleep(sleep);
        } catch (InterruptedException e) {
          LOG.debug("Interrupted while waiting for snapshot " + snapshot + " restore to complete");
          Thread.currentThread().interrupt();
        }
        LOG.debug("Getting current status of snapshot restore from master...");
        done = getMaster().isRestoreSnapshotDone(snapshot);
      }
      if (!done) {
        throw new RestoreSnapshotException("Snapshot '" + snapshot.getName() + "' wasn't restored.");
      }
    } catch (RemoteException e) {
      throw RemoteExceptionHandler.decodeRemoteException(e);
    }
  }
View Full Code Here

    HTableDescriptor.isLegalTableName(snapshotName);
    // do the delete
    SnapshotDescription snapshot = SnapshotDescription.newBuilder()
      .setName(Bytes.toString(snapshotName)).build();
    try {
      getMaster().deleteSnapshot(new HSnapshotDescription(snapshot));
    } catch (RemoteException e) {
      throw RemoteExceptionHandler.decodeRemoteException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.snapshot.HSnapshotDescription

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.