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

项目:ditb    文件:HBaseAdmin.java   
/**
 * Deletes the table but does not block and wait for it be completely removed.
 * You can use Future.get(long, TimeUnit) to wait on the operation to complete.
 * It may throw ExecutionException if there was an error while executing the operation
 * or TimeoutException in case the wait timeout was not long enough to allow the
 * operation to complete.
 *
 * @param desc table descriptor for table
 * @param tableName name of table to delete
 * @throws IOException if a remote or network exception occurs
 * @return the result of the async delete. You can use Future.get(long, TimeUnit)
 *    to wait on the operation to complete.
 */
// TODO: This should be called Async but it will break binary compatibility
private Future<Void> deleteTableAsyncV2(final TableName tableName) throws IOException {
  DeleteTableResponse response = executeCallable(
    new MasterCallable<DeleteTableResponse>(getConnection()) {
      @Override
      public DeleteTableResponse call(int callTimeout) throws ServiceException {
        PayloadCarryingRpcController controller = rpcControllerFactory.newController();
        controller.setCallTimeout(callTimeout);
        controller.setPriority(tableName);
        DeleteTableRequest req =
            RequestConverter.buildDeleteTableRequest(tableName, ng.getNonceGroup(),ng.newNonce());
        return master.deleteTable(controller,req);
      }
    });
  return new DeleteTableFuture(this, tableName, response);
}
项目:ditb    文件:MasterRpcServices.java   
@Override
public DeleteTableResponse deleteTable(RpcController controller,
    DeleteTableRequest request) throws ServiceException {
  try {
    long procId = master.deleteTable(ProtobufUtil.toTableName(
        request.getTableName()), request.getNonceGroup(), request.getNonce());
    return DeleteTableResponse.newBuilder().setProcId(procId).build();
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
}
项目:ditb    文件:RequestConverter.java   
/**
 * Creates a protocol buffer DeleteTableRequest
 *
 * @param tableName
 * @return a DeleteTableRequest
 */
public static DeleteTableRequest buildDeleteTableRequest(
    final TableName tableName,
    final long nonceGroup,
    final long nonce) {
  DeleteTableRequest.Builder builder = DeleteTableRequest.newBuilder();
  builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
  builder.setNonceGroup(nonceGroup);
  builder.setNonce(nonce);
  return builder.build();
}
项目:pbase    文件:MasterRpcServices.java   
@Override
public DeleteTableResponse deleteTable(RpcController controller,
    DeleteTableRequest request) throws ServiceException {
  try {
    master.deleteTable(ProtobufUtil.toTableName(request.getTableName()));
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
  return DeleteTableResponse.newBuilder().build();
}
项目:HIndex    文件:HMaster.java   
@Override
public DeleteTableResponse deleteTable(RpcController controller, DeleteTableRequest request)
throws ServiceException {
  try {
    deleteTable(ProtobufUtil.toTableName(request.getTableName()));
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
  return DeleteTableResponse.newBuilder().build();
}
项目:PyroDB    文件:MasterRpcServices.java   
@Override
public DeleteTableResponse deleteTable(RpcController controller,
    DeleteTableRequest request) throws ServiceException {
  try {
    master.deleteTable(ProtobufUtil.toTableName(request.getTableName()));
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
  return DeleteTableResponse.newBuilder().build();
}
项目:c5    文件:HMaster.java   
@Override
public DeleteTableResponse deleteTable(RpcController controller, DeleteTableRequest request)
throws ServiceException {
  try {
    deleteTable(ProtobufUtil.toTableName(request.getTableName()));
  } catch (IOException ioe) {
    throw new ServiceException(ioe);
  }
  return DeleteTableResponse.newBuilder().build();
}
项目:pbase    文件:HBaseAdmin.java   
/**
 * Deletes a table.
 * Synchronous operation.
 *
 * @param tableName name of table to delete
 * @throws IOException if a remote or network exception occurs
 */
@Override
public void deleteTable(final TableName tableName) throws IOException {
  boolean tableExists = true;

  executeCallable(new MasterCallable<Void>(getConnection()) {
    @Override
    public Void call(int callTimeout) throws ServiceException {
      DeleteTableRequest req = RequestConverter.buildDeleteTableRequest(tableName);
      master.deleteTable(null,req);
      return null;
    }
  });

  int failures = 0;
  // Wait until all regions deleted
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    try {
      // Find whether all regions are deleted.
      List<RegionLocations> regionLations =
          MetaScanner.listTableRegionLocations(conf, connection, tableName);

      // let us wait until hbase:meta table is updated and
      // HMaster removes the table from its HTableDescriptors
      if (regionLations == null || regionLations.size() == 0) {
        HTableDescriptor htd = getTableDescriptorByTableName(tableName);

        if (htd == null) {
          // table could not be found in master - we are done.
          tableExists = false;
          break;
        }
      }
    } catch (IOException ex) {
      failures++;
      if(failures >= numRetries - 1) {           // no more tries left
        if (ex instanceof RemoteException) {
          throw ((RemoteException) ex).unwrapRemoteException();
        } else {
          throw ex;
        }
      }
    }
    try {
      Thread.sleep(getPauseTime(tries));
    } catch (InterruptedException e) {
      throw new InterruptedIOException("Interrupted when waiting" +
          " for table to be deleted");
    }
  }

  if (tableExists) {
    throw new IOException("Retries exhausted, it took too long to wait"+
      " for the table " + tableName + " to be deleted.");
  }
  // Delete cached information to prevent clients from using old locations
  this.connection.clearRegionCache(tableName);
  LOG.info("Deleted " + tableName);
}
项目:pbase    文件:RequestConverter.java   
/**
 * Creates a protocol buffer DeleteTableRequest
 *
 * @param tableName
 * @return a DeleteTableRequest
 */
public static DeleteTableRequest buildDeleteTableRequest(final TableName tableName) {
  DeleteTableRequest.Builder builder = DeleteTableRequest.newBuilder();
  builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
  return builder.build();
}
项目:HIndex    文件:RequestConverter.java   
/**
 * Creates a protocol buffer DeleteTableRequest
 *
 * @param tableName
 * @return a DeleteTableRequest
 */
public static DeleteTableRequest buildDeleteTableRequest(final TableName tableName) {
  DeleteTableRequest.Builder builder = DeleteTableRequest.newBuilder();
  builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
  return builder.build();
}
项目:PyroDB    文件:RequestConverter.java   
/**
 * Creates a protocol buffer DeleteTableRequest
 *
 * @param tableName
 * @return a DeleteTableRequest
 */
public static DeleteTableRequest buildDeleteTableRequest(final TableName tableName) {
  DeleteTableRequest.Builder builder = DeleteTableRequest.newBuilder();
  builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
  return builder.build();
}
项目:c5    文件:RequestConverter.java   
/**
 * Creates a protocol buffer DeleteTableRequest
 *
 * @param tableName
 * @return a DeleteTableRequest
 */
public static DeleteTableRequest buildDeleteTableRequest(final TableName tableName) {
  DeleteTableRequest.Builder builder = DeleteTableRequest.newBuilder();
  builder.setTableName(ProtobufUtil.toProtoTableName(tableName));
  return builder.build();
}