/** * Disable the table but does not block and wait for it be completely disabled. * 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 tableName name of table to delete * @throws IOException if a remote or network exception occurs * @return the result of the async disable. 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> disableTableAsyncV2(final TableName tableName) throws IOException { TableName.isLegalFullyQualifiedTableName(tableName.getName()); DisableTableResponse response = executeCallable( new MasterCallable<DisableTableResponse>(getConnection()) { @Override public DisableTableResponse call(int callTimeout) throws ServiceException { PayloadCarryingRpcController controller = rpcControllerFactory.newController(); controller.setCallTimeout(callTimeout); controller.setPriority(tableName); LOG.info("Started disable of " + tableName); DisableTableRequest req = RequestConverter.buildDisableTableRequest( tableName, ng.getNonceGroup(), ng.newNonce()); return master.disableTable(controller, req); } }); return new DisableTableFuture(this, tableName, response); }
@Override public DisableTableResponse disableTable(RpcController controller, DisableTableRequest request) throws ServiceException { try { long procId = master.disableTable( ProtobufUtil.toTableName(request.getTableName()), request.getNonceGroup(), request.getNonce()); return DisableTableResponse.newBuilder().setProcId(procId).build(); } catch (IOException ioe) { throw new ServiceException(ioe); } }
/** * Creates a protocol buffer DisableTableRequest * * @param tableName * @return a DisableTableRequest */ public static DisableTableRequest buildDisableTableRequest( final TableName tableName, final long nonceGroup, final long nonce) { DisableTableRequest.Builder builder = DisableTableRequest.newBuilder(); builder.setTableName(ProtobufUtil.toProtoTableName((tableName))); builder.setNonceGroup(nonceGroup); builder.setNonce(nonce); return builder.build(); }
@Override public DisableTableResponse disableTable(RpcController controller, DisableTableRequest request) throws ServiceException { try { master.disableTable(ProtobufUtil.toTableName(request.getTableName())); } catch (IOException ioe) { throw new ServiceException(ioe); } return DisableTableResponse.newBuilder().build(); }
/** * Starts the disable of a table. If it is being served, the master * will tell the servers to stop serving it. This method returns immediately. * The disable of a table can take some time if the table is large (all * regions are closed as part of table disable operation). * Call {@link #isTableDisabled(byte[])} to check for when disable completes. * If table is taking too long to online, check server logs. * @param tableName name of table * @throws IOException if a remote or network exception occurs * @see #isTableDisabled(byte[]) * @see #isTableEnabled(byte[]) * @since 0.90.0 */ @Override public void disableTableAsync(final TableName tableName) throws IOException { TableName.isLegalFullyQualifiedTableName(tableName.getName()); executeCallable(new MasterCallable<Void>(getConnection()) { @Override public Void call(int callTimeout) throws ServiceException { LOG.info("Started disable of " + tableName); DisableTableRequest req = RequestConverter.buildDisableTableRequest(tableName); master.disableTable(null,req); return null; } }); }
@Override public DisableTableResponse disableTable(RpcController controller, DisableTableRequest request) throws ServiceException { try { disableTable(ProtobufUtil.toTableName(request.getTableName())); } catch (IOException ioe) { throw new ServiceException(ioe); } return DisableTableResponse.newBuilder().build(); }
/** * Starts the disable of a table. If it is being served, the master * will tell the servers to stop serving it. This method returns immediately. * The disable of a table can take some time if the table is large (all * regions are closed as part of table disable operation). * Call {@link #isTableDisabled(byte[])} to check for when disable completes. * If table is taking too long to online, check server logs. * @param tableName name of table * @throws IOException if a remote or network exception occurs * @see #isTableDisabled(byte[]) * @see #isTableEnabled(byte[]) * @since 0.90.0 */ public void disableTableAsync(final TableName tableName) throws IOException { TableName.isLegalFullyQualifiedTableName(tableName.getName()); executeCallable(new MasterCallable<Void>(getConnection()) { @Override public Void call() throws ServiceException { LOG.info("Started disable of " + tableName); DisableTableRequest req = RequestConverter.buildDisableTableRequest(tableName); master.disableTable(null,req); return null; } }); }
/** * Starts the disable of a table. If it is being served, the master * will tell the servers to stop serving it. This method returns immediately. * The disable of a table can take some time if the table is large (all * regions are closed as part of table disable operation). * Call {@link #isTableDisabled(byte[])} to check for when disable completes. * If table is taking too long to online, check server logs. * @param tableName name of table * @throws IOException if a remote or network exception occurs * @see #isTableDisabled(byte[]) * @see #isTableEnabled(byte[]) * @since 0.90.0 */ public void disableTableAsync(final TableName tableName) throws IOException { TableName.isLegalFullyQualifiedTableName(tableName.getName()); executeCallable(new MasterCallable<Void>(getConnection()) { @Override public Void call(int callTimeout) throws ServiceException { LOG.info("Started disable of " + tableName); DisableTableRequest req = RequestConverter.buildDisableTableRequest(tableName); master.disableTable(null,req); return null; } }); }
/** * Creates a protocol buffer DisableTableRequest * * @param tableName * @return a DisableTableRequest */ public static DisableTableRequest buildDisableTableRequest(final TableName tableName) { DisableTableRequest.Builder builder = DisableTableRequest.newBuilder(); builder.setTableName(ProtobufUtil.toProtoTableName((tableName))); return builder.build(); }