/** * Enable the table but does not block and wait for it be completely enabled. * 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 enable. 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> enableTableAsyncV2(final TableName tableName) throws IOException { TableName.isLegalFullyQualifiedTableName(tableName.getName()); EnableTableResponse response = executeCallable( new MasterCallable<EnableTableResponse>(getConnection()) { @Override public EnableTableResponse call(int callTimeout) throws ServiceException { PayloadCarryingRpcController controller = rpcControllerFactory.newController(); controller.setCallTimeout(callTimeout); controller.setPriority(tableName); LOG.info("Started enable of " + tableName); EnableTableRequest req = RequestConverter.buildEnableTableRequest(tableName, ng.getNonceGroup(),ng.newNonce()); return master.enableTable(controller,req); } }); return new EnableTableFuture(this, tableName, response); }
@Override public EnableTableResponse enableTable(RpcController controller, EnableTableRequest request) throws ServiceException { try { long procId = master.enableTable( ProtobufUtil.toTableName(request.getTableName()), request.getNonceGroup(), request.getNonce()); return EnableTableResponse.newBuilder().setProcId(procId).build(); } catch (IOException ioe) { throw new ServiceException(ioe); } }
/** * Creates a protocol buffer EnableTableRequest * * @param tableName * @return an EnableTableRequest */ public static EnableTableRequest buildEnableTableRequest( final TableName tableName, final long nonceGroup, final long nonce) { EnableTableRequest.Builder builder = EnableTableRequest.newBuilder(); builder.setTableName(ProtobufUtil.toProtoTableName(tableName)); builder.setNonceGroup(nonceGroup); builder.setNonce(nonce); return builder.build(); }
@Override public EnableTableResponse enableTable(RpcController controller, EnableTableRequest request) throws ServiceException { try { master.enableTable(ProtobufUtil.toTableName(request.getTableName())); } catch (IOException ioe) { throw new ServiceException(ioe); } return EnableTableResponse.newBuilder().build(); }
/** * Brings a table on-line (enables it). Method returns immediately though * enable of table may take some time to complete, especially if the table * is large (All regions are opened as part of enabling process). Check * {@link #isTableEnabled(byte[])} to learn when table is fully online. If * table is taking too long to online, check server logs. * @param tableName * @throws IOException * @since 0.90.0 */ @Override public void enableTableAsync(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 enable of " + tableName); EnableTableRequest req = RequestConverter.buildEnableTableRequest(tableName); master.enableTable(null,req); return null; } }); }
@Override public EnableTableResponse enableTable(RpcController controller, EnableTableRequest request) throws ServiceException { try { enableTable(ProtobufUtil.toTableName(request.getTableName())); } catch (IOException ioe) { throw new ServiceException(ioe); } return EnableTableResponse.newBuilder().build(); }
/** * Brings a table on-line (enables it). Method returns immediately though * enable of table may take some time to complete, especially if the table * is large (All regions are opened as part of enabling process). Check * {@link #isTableEnabled(byte[])} to learn when table is fully online. If * table is taking too long to online, check server logs. * @param tableName * @throws IOException * @since 0.90.0 */ public void enableTableAsync(final TableName tableName) throws IOException { TableName.isLegalFullyQualifiedTableName(tableName.getName()); executeCallable(new MasterCallable<Void>(getConnection()) { @Override public Void call() throws ServiceException { LOG.info("Started enable of " + tableName); EnableTableRequest req = RequestConverter.buildEnableTableRequest(tableName); master.enableTable(null,req); return null; } }); }
/** * Brings a table on-line (enables it). Method returns immediately though * enable of table may take some time to complete, especially if the table * is large (All regions are opened as part of enabling process). Check * {@link #isTableEnabled(byte[])} to learn when table is fully online. If * table is taking too long to online, check server logs. * @param tableName * @throws IOException * @since 0.90.0 */ public void enableTableAsync(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 enable of " + tableName); EnableTableRequest req = RequestConverter.buildEnableTableRequest(tableName); master.enableTable(null,req); return null; } }); }
/** * Creates a protocol buffer EnableTableRequest * * @param tableName * @return an EnableTableRequest */ public static EnableTableRequest buildEnableTableRequest(final TableName tableName) { EnableTableRequest.Builder builder = EnableTableRequest.newBuilder(); builder.setTableName(ProtobufUtil.toProtoTableName(tableName)); return builder.build(); }