Java 类org.apache.hadoop.hbase.protobuf.generated.MasterProtos.DeleteSnapshotRequest 实例源码

项目:ditb    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testDeleteSnapshot() throws Exception {

  String snapshotName = "completed";
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();

  DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot)
      .build();
  try {
    master.getMasterRpcServices().deleteSnapshot(null, request);
    fail("Master didn't throw exception when attempting to delete snapshot that doesn't exist");
  } catch (ServiceException e) {
    LOG.debug("Correctly failed delete of non-existant snapshot:" + e.getMessage());
  }

  // write one snapshot to the fs
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // then delete the existing snapshot,which shouldn't cause an exception to be thrown
  master.getMasterRpcServices().deleteSnapshot(null, request);
}
项目:ditb    文件:HBaseAdmin.java   
/**
 * Delete an existing snapshot.
 * @param snapshotName name of the snapshot
 * @throws IOException if a remote or network exception occurs
 */
@Override
public void deleteSnapshot(final String snapshotName) throws IOException {
  // make sure the snapshot is possibly valid
  TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(snapshotName));
  // do the delete
  executeCallable(new MasterCallable<Void>(getConnection()) {
    @Override
    public Void call(int callTimeout) throws ServiceException {
      PayloadCarryingRpcController controller = rpcControllerFactory.newController();
      controller.setCallTimeout(callTimeout);
      master.deleteSnapshot(controller,
        DeleteSnapshotRequest.newBuilder().
          setSnapshot(SnapshotDescription.newBuilder().setName(snapshotName).build()).build()
      );
      return null;
    }
  });
}
项目:pbase    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testDeleteSnapshot() throws Exception {

  String snapshotName = "completed";
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();

  DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot)
      .build();
  try {
    master.getMasterRpcServices().deleteSnapshot(null, request);
    fail("Master didn't throw exception when attempting to delete snapshot that doesn't exist");
  } catch (ServiceException e) {
    LOG.debug("Correctly failed delete of non-existant snapshot:" + e.getMessage());
  }

  // write one snapshot to the fs
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // then delete the existing snapshot,which shouldn't cause an exception to be thrown
  master.getMasterRpcServices().deleteSnapshot(null, request);
}
项目:pbase    文件:HBaseAdmin.java   
/**
 * Delete an existing snapshot.
 * @param snapshotName name of the snapshot
 * @throws IOException if a remote or network exception occurs
 */
@Override
public void deleteSnapshot(final String snapshotName) throws IOException {
  // make sure the snapshot is possibly valid
  TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(snapshotName));
  // do the delete
  executeCallable(new MasterCallable<Void>(getConnection()) {
    @Override
    public Void call(int callTimeout) throws ServiceException {
      master.deleteSnapshot(null,
        DeleteSnapshotRequest.newBuilder().
          setSnapshot(SnapshotDescription.newBuilder().setName(snapshotName).build()).build()
      );
      return null;
    }
  });
}
项目:HIndex    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testDeleteSnapshot() throws Exception {

  String snapshotName = "completed";
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();

  DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot)
      .build();
  try {
    master.deleteSnapshot(null, request);
    fail("Master didn't throw exception when attempting to delete snapshot that doesn't exist");
  } catch (ServiceException e) {
    LOG.debug("Correctly failed delete of non-existant snapshot:" + e.getMessage());
  }

  // write one snapshot to the fs
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // then delete the existing snapshot,which shouldn't cause an exception to be thrown
  master.deleteSnapshot(null, request);
}
项目:PyroDB    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testDeleteSnapshot() throws Exception {

  String snapshotName = "completed";
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();

  DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot)
      .build();
  try {
    master.getMasterRpcServices().deleteSnapshot(null, request);
    fail("Master didn't throw exception when attempting to delete snapshot that doesn't exist");
  } catch (ServiceException e) {
    LOG.debug("Correctly failed delete of non-existant snapshot:" + e.getMessage());
  }

  // write one snapshot to the fs
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // then delete the existing snapshot,which shouldn't cause an exception to be thrown
  master.getMasterRpcServices().deleteSnapshot(null, request);
}
项目:c5    文件:TestSnapshotFromMaster.java   
@Test(timeout = 300000)
public void testDeleteSnapshot() throws Exception {

  String snapshotName = "completed";
  SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName(snapshotName).build();

  DeleteSnapshotRequest request = DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot)
      .build();
  try {
    master.deleteSnapshot(null, request);
    fail("Master didn't throw exception when attempting to delete snapshot that doesn't exist");
  } catch (ServiceException e) {
    LOG.debug("Correctly failed delete of non-existant snapshot:" + e.getMessage());
  }

  // write one snapshot to the fs
  Path snapshotDir = SnapshotDescriptionUtils.getCompletedSnapshotDir(snapshotName, rootDir);
  SnapshotDescriptionUtils.writeSnapshotInfo(snapshot, snapshotDir, fs);

  // then delete the existing snapshot,which shouldn't cause an exception to be thrown
  master.deleteSnapshot(null, request);
}
项目:ditb    文件:MasterRpcServices.java   
/**
 * Execute Delete Snapshot operation.
 * @return DeleteSnapshotResponse (a protobuf wrapped void) if the snapshot existed and was
 *    deleted properly.
 * @throws ServiceException wrapping SnapshotDoesNotExistException if specified snapshot did not
 *    exist.
 */
@Override
public DeleteSnapshotResponse deleteSnapshot(RpcController controller,
    DeleteSnapshotRequest request) throws ServiceException {
  try {
    master.checkInitialized();
    master.snapshotManager.checkSnapshotSupport();

    LOG.info(master.getClientIdAuditPrefix() + " delete " + request.getSnapshot());
    master.snapshotManager.deleteSnapshot(request.getSnapshot());
    return DeleteSnapshotResponse.newBuilder().build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:ditb    文件:HBaseAdmin.java   
private void internalDeleteSnapshot(final SnapshotDescription snapshot) throws IOException {
  executeCallable(new MasterCallable<Void>(getConnection()) {
    @Override
    public Void call(int callTimeout) throws ServiceException {
      PayloadCarryingRpcController controller = rpcControllerFactory.newController();
      controller.setCallTimeout(callTimeout);
      this.master.deleteSnapshot(controller, DeleteSnapshotRequest.newBuilder()
        .setSnapshot(snapshot).build());
      return null;
    }
  });
}
项目:pbase    文件:MasterRpcServices.java   
/**
 * Execute Delete Snapshot operation.
 * @return DeleteSnapshotResponse (a protobuf wrapped void) if the snapshot existed and was
 *    deleted properly.
 * @throws ServiceException wrapping SnapshotDoesNotExistException if specified snapshot did not
 *    exist.
 */
@Override
public DeleteSnapshotResponse deleteSnapshot(RpcController controller,
    DeleteSnapshotRequest request) throws ServiceException {
  try {
    master.checkInitialized();
    master.snapshotManager.checkSnapshotSupport();

    LOG.info(master.getClientIdAuditPrefix() + " delete " + request.getSnapshot());
    master.snapshotManager.deleteSnapshot(request.getSnapshot());
    return DeleteSnapshotResponse.newBuilder().build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:pbase    文件:HBaseAdmin.java   
private void internalDeleteSnapshot(final SnapshotDescription snapshot) throws IOException {
  executeCallable(new MasterCallable<Void>(getConnection()) {
    @Override
    public Void call(int callTimeout) throws ServiceException {
      this.master.deleteSnapshot(null, DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot)
          .build());
      return null;
    }
  });
}
项目:HIndex    文件:HBaseAdmin.java   
/**
 * Delete an existing snapshot.
 * @param snapshotName name of the snapshot
 * @throws IOException if a remote or network exception occurs
 */
public void deleteSnapshot(final String snapshotName) throws IOException {
  // make sure the snapshot is possibly valid
  TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(snapshotName));
  // do the delete
  executeCallable(new MasterCallable<Void>(getConnection()) {
    @Override
    public Void call() throws ServiceException {
      master.deleteSnapshot(null,
        DeleteSnapshotRequest.newBuilder().
          setSnapshot(SnapshotDescription.newBuilder().setName(snapshotName).build()).build());
      return null;
    }
  });
}
项目:HIndex    文件:HBaseAdmin.java   
/**
 * Delete existing snapshots whose names match the pattern passed.
 * @param pattern pattern for names of the snapshot to match
 * @throws IOException if a remote or network exception occurs
 */
public void deleteSnapshots(final Pattern pattern) throws IOException {
  List<SnapshotDescription> snapshots = listSnapshots(pattern);
  for (final SnapshotDescription snapshot : snapshots) {
    // do the delete
    executeCallable(new MasterCallable<Void>(getConnection()) {
      @Override
      public Void call() throws ServiceException {
        this.master.deleteSnapshot(null,
          DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot).build());
        return null;
      }
    });
  }
}
项目:PyroDB    文件:MasterRpcServices.java   
/**
 * Execute Delete Snapshot operation.
 * @return DeleteSnapshotResponse (a protobuf wrapped void) if the snapshot existed and was
 *    deleted properly.
 * @throws ServiceException wrapping SnapshotDoesNotExistException if specified snapshot did not
 *    exist.
 */
@Override
public DeleteSnapshotResponse deleteSnapshot(RpcController controller,
    DeleteSnapshotRequest request) throws ServiceException {
  try {
    master.checkInitialized();
    master.snapshotManager.checkSnapshotSupport();

    LOG.info(master.getClientIdAuditPrefix() + " delete " + request.getSnapshot());
    master.snapshotManager.deleteSnapshot(request.getSnapshot());
    return DeleteSnapshotResponse.newBuilder().build();
  } catch (IOException e) {
    throw new ServiceException(e);
  }
}
项目:PyroDB    文件:HBaseAdmin.java   
/**
 * Delete an existing snapshot.
 * @param snapshotName name of the snapshot
 * @throws IOException if a remote or network exception occurs
 */
public void deleteSnapshot(final String snapshotName) throws IOException {
  // make sure the snapshot is possibly valid
  TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(snapshotName));
  // do the delete
  executeCallable(new MasterCallable<Void>(getConnection()) {
    @Override
    public Void call(int callTimeout) throws ServiceException {
      master.deleteSnapshot(null,
        DeleteSnapshotRequest.newBuilder().
          setSnapshot(SnapshotDescription.newBuilder().setName(snapshotName).build()).build());
      return null;
    }
  });
}
项目:PyroDB    文件:HBaseAdmin.java   
/**
 * Delete existing snapshots whose names match the pattern passed.
 * @param pattern pattern for names of the snapshot to match
 * @throws IOException if a remote or network exception occurs
 */
public void deleteSnapshots(final Pattern pattern) throws IOException {
  List<SnapshotDescription> snapshots = listSnapshots(pattern);
  for (final SnapshotDescription snapshot : snapshots) {
    // do the delete
    executeCallable(new MasterCallable<Void>(getConnection()) {
      @Override
      public Void call(int callTimeout) throws ServiceException {
        this.master.deleteSnapshot(null,
          DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot).build());
        return null;
      }
    });
  }
}
项目:c5    文件:HBaseAdmin.java   
/**
 * Delete an existing snapshot.
 * @param snapshotName name of the snapshot
 * @throws IOException if a remote or network exception occurs
 */
public void deleteSnapshot(final String snapshotName) throws IOException {
  // make sure the snapshot is possibly valid
  TableName.isLegalFullyQualifiedTableName(Bytes.toBytes(snapshotName));
  // do the delete
  executeCallable(new MasterCallable<Void>(getConnection()) {
    @Override
    public Void call() throws ServiceException {
      master.deleteSnapshot(null,
        DeleteSnapshotRequest.newBuilder().
          setSnapshot(SnapshotDescription.newBuilder().setName(snapshotName).build()).build());
      return null;
    }
  });
}
项目:c5    文件:HBaseAdmin.java   
/**
 * Delete existing snapshots whose names match the pattern passed.
 * @param pattern pattern for names of the snapshot to match
 * @throws IOException if a remote or network exception occurs
 */
public void deleteSnapshots(final Pattern pattern) throws IOException {
  List<SnapshotDescription> snapshots = listSnapshots(pattern);
  for (final SnapshotDescription snapshot : snapshots) {
    // do the delete
    executeCallable(new MasterCallable<Void>(getConnection()) {
      @Override
      public Void call() throws ServiceException {
        this.master.deleteSnapshot(null,
          DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot).build());
        return null;
      }
    });
  }
}