Package org.apache.hadoop.hbase.snapshot

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


        break;
      }
    }

    if (tableName == null) {
      throw new RestoreSnapshotException(
        "Unable to find the table name for snapshot=" + snapshotName);
    }

    // Take a snapshot of the current state
    snapshot(rollbackSnapshot, tableName);

    // Restore snapshot
    try {
      internalRestoreSnapshot(snapshotName, tableName);
    } catch (IOException e) {
      // Try to rollback
      try {
        String msg = "Restore snapshot=" + snapshotName +
          " failed. Rollback to snapshot=" + rollbackSnapshot + " succeeded.";
        LOG.error(msg, e);
        internalRestoreSnapshot(rollbackSnapshot, tableName);
        throw new RestoreSnapshotException(msg, e);
      } catch (IOException ex) {
        String msg = "Failed to restore and rollback to snapshot=" + rollbackSnapshot;
        LOG.error(msg, ex);
        throw new RestoreSnapshotException(msg, ex);
      }
    }
  }
View Full Code Here


        }
        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

      // 2. let the CreateTableHandler add the regions to meta
      return metaChanges.getRegionsToAdd();
    } catch (Exception e) {
      String msg = "clone snapshot=" + SnapshotDescriptionUtils.toString(snapshot) + " failed";
      LOG.error(msg, e);
      IOException rse = new RestoreSnapshotException(msg, e, snapshot);

      // these handlers aren't futures so we need to register the error here.
      this.monitor.receive(new ForeignException(NAME, rse));
      throw rse;
    }
View Full Code Here

    } catch (IOException e) {
      String msg = "restore snapshot=" + SnapshotDescriptionUtils.toString(snapshot)
          + " failed. Try re-running the restore command.";
      LOG.error(msg, e);
      monitor.receive(new ForeignException(masterServices.getServerName().toString(), e));
      throw new RestoreSnapshotException(msg, e);
    } finally {
      this.stopped = true;
    }
  }
View Full Code Here

      final HTableDescriptor hTableDescriptor) throws HBaseSnapshotException {
    String tableName = hTableDescriptor.getNameAsString();

    // make sure we aren't running a snapshot on the same table
    if (isTakingSnapshot(tableName)) {
      throw new RestoreSnapshotException("Snapshot in progress on the restore table=" + tableName);
    }

    // make sure we aren't running a restore on the same table
    if (isRestoringTable(tableName)) {
      throw new RestoreSnapshotException("Restore already in progress on the table=" + tableName);
    }

    try {
      CloneSnapshotHandler handler =
        new CloneSnapshotHandler(master, snapshot, hTableDescriptor);
      this.executorService.submit(handler);
      restoreHandlers.put(tableName, handler);
    } catch (Exception e) {
      String msg = "Couldn't clone the snapshot=" + SnapshotDescriptionUtils.toString(snapshot) +
        " on table=" + tableName;
      LOG.error(msg, e);
      throw new RestoreSnapshotException(msg, e);
    }
  }
View Full Code Here

      final HTableDescriptor hTableDescriptor) throws HBaseSnapshotException {
    String tableName = hTableDescriptor.getNameAsString();

    // make sure we aren't running a snapshot on the same table
    if (isTakingSnapshot(tableName)) {
      throw new RestoreSnapshotException("Snapshot in progress on the restore table=" + tableName);
    }

    // make sure we aren't running a restore on the same table
    if (isRestoringTable(tableName)) {
      throw new RestoreSnapshotException("Restore already in progress on the table=" + tableName);
    }

    try {
      RestoreSnapshotHandler handler =
        new RestoreSnapshotHandler(master, snapshot, hTableDescriptor);
      this.executorService.submit(handler);
      restoreHandlers.put(hTableDescriptor.getNameAsString(), handler);
    } catch (Exception e) {
      String msg = "Couldn't restore the snapshot=" + SnapshotDescriptionUtils.toString(snapshot+
          " on table=" + tableName;
      LOG.error(msg, e);
      throw new RestoreSnapshotException(msg, e);
    }
  }
View Full Code Here

    } catch (IOException e) {
      String msg = "restore snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot)
          + " failed. Try re-running the restore command.";
      LOG.error(msg, e);
      monitor.receive(new ForeignException(masterServices.getServerName().toString(), e));
      throw new RestoreSnapshotException(msg, e);
    }
  }
View Full Code Here

        break;
      }
    }

    if (tableName == null) {
      throw new RestoreSnapshotException(
        "Unable to find the table name for snapshot=" + snapshotName);
    }

    // Take a snapshot of the current state
    snapshot(rollbackSnapshot, tableName);

    // Restore snapshot
    try {
      internalRestoreSnapshot(snapshotName, tableName);
    } catch (IOException e) {
      // Try to rollback
      try {
        String msg = "Restore snapshot=" + snapshotName +
          " failed. Rollback to snapshot=" + rollbackSnapshot + " succeeded.";
        LOG.error(msg, e);
        internalRestoreSnapshot(rollbackSnapshot, tableName);
        throw new RestoreSnapshotException(msg, e);
      } catch (IOException ex) {
        String msg = "Failed to restore and rollback to snapshot=" + rollbackSnapshot;
        LOG.error(msg, ex);
        throw new RestoreSnapshotException(msg, ex);
      }
    }
  }
View Full Code Here

          return master.isRestoreSnapshotDone(null, request);
        }
      });
    }
    if (!done.getDone()) {
      throw new RestoreSnapshotException("Snapshot '" + snapshot.getName() + "' wasn't restored.");
    }
  }
View Full Code Here

      final HTableDescriptor hTableDescriptor) throws HBaseSnapshotException {
    String tableName = hTableDescriptor.getNameAsString();

    // make sure we aren't running a snapshot on the same table
    if (isTakingSnapshot(tableName)) {
      throw new RestoreSnapshotException("Snapshot in progress on the restore table=" + tableName);
    }

    // make sure we aren't running a restore on the same table
    if (isRestoringTable(tableName)) {
      throw new RestoreSnapshotException("Restore already in progress on the table=" + tableName);
    }

    try {
      CloneSnapshotHandler handler =
        new CloneSnapshotHandler(master, snapshot, hTableDescriptor, metricsMaster);
      this.executorService.submit(handler);
      this.restoreHandlers.put(tableName, handler);
    } catch (Exception e) {
      String msg = "Couldn't clone the snapshot=" + SnapshotDescriptionUtils.toString(snapshot) +
        " on table=" + tableName;
      LOG.error(msg, e);
      throw new RestoreSnapshotException(msg, e);
    }
  }
View Full Code Here

TOP

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

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.