protected void waitForAllRegionsOnline(final long deadlineTs, final byte[][] splitKeys) throws IOException, TimeoutException { final TableDescriptor desc = getTableDescriptor(); final AtomicInteger actualRegCount = new AtomicInteger(0); final MetaTableAccessor.Visitor visitor = new MetaTableAccessor.Visitor() { while (EnvironmentEdgeManager.currentTime() < deadlineTs) { actualRegCount.set(0); MetaTableAccessor.scanMetaForTableRegions(getAdmin().getConnection(), visitor, desc.getTableName()); if (actualRegCount.get() == numRegs) { Thread.sleep(getAdmin().getPauseTime(tries++)); } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted when opening" + " regions; "
@Override protected V postOperationFailure(final IOException exception, final long deadlineTs) throws IOException, TimeoutException { LOG.info(getDescription() + " failed with " + exception.getMessage()); return super.postOperationFailure(exception, deadlineTs); }
protected void waitForAllRegionsOnline(final long deadlineTs, final byte[][] splitKeys) throws IOException, TimeoutException { final TableDescriptor desc = getTableDescriptor(); final AtomicInteger actualRegCount = new AtomicInteger(0); final MetaTableAccessor.Visitor visitor = new MetaTableAccessor.Visitor() { while (EnvironmentEdgeManager.currentTime() < deadlineTs) { actualRegCount.set(0); MetaTableAccessor.scanMetaForTableRegions(getAdmin().getConnection(), visitor, desc.getTableName()); if (actualRegCount.get() == numRegs) { Thread.sleep(getAdmin().getPauseTime(tries++)); } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted when opening" + " regions; "
protected void waitForTableEnabled(final long deadlineTs) throws IOException, TimeoutException { waitForState(deadlineTs, new TableWaitForStateCallable() { @Override public boolean checkState(int tries) throws IOException { try { if (getAdmin().isTableAvailable(tableName)) { return true; } } catch (TableNotFoundException tnfe) { LOG.debug("Table " + tableName.getNameWithNamespaceInclAsString() + " was not enabled, sleeping. tries=" + tries); } return false; } }); }
@Override public String toString() { return getDescription(); }
protected void waitForSchemaUpdate(final long deadlineTs) throws IOException, TimeoutException { waitForState(deadlineTs, new TableWaitForStateCallable() { @Override public boolean checkState(int tries) throws IOException { return getAdmin().getAlterStatus(tableName).getFirst() == 0; } }); }
protected void waitForTableDisabled(final long deadlineTs) throws IOException, TimeoutException { waitForState(deadlineTs, new TableWaitForStateCallable() { @Override public boolean checkState(int tries) throws IOException { return getAdmin().isTableDisabled(tableName); } }); }
@Override public boolean checkState(int tries) throws IOException { try { if (getAdmin().isTableAvailable(tableName)) { return true; } } catch (TableNotFoundException tnfe) { LOG.debug("Table " + tableName.getNameWithNamespaceInclAsString() + " was not enabled, sleeping. tries=" + tries); } return false; } });
@Override public boolean checkState(int tries) throws IOException { return !getAdmin().tableExists(tableName); } });
@Override public boolean checkState(int tries) throws IOException { return getAdmin().isTableDisabled(tableName); } });
@Override protected V postOperationResult(final V result, final long deadlineTs) throws IOException, TimeoutException { LOG.info(getDescription() + " completed"); return super.postOperationResult(result, deadlineTs); }
@Override protected V postOperationFailure(final IOException exception, final long deadlineTs) throws IOException, TimeoutException { LOG.info(getDescription() + " failed with " + exception.getMessage()); return super.postOperationFailure(exception, deadlineTs); }
protected void waitTableNotFound(final long deadlineTs) throws IOException, TimeoutException { waitForState(deadlineTs, new TableWaitForStateCallable() { @Override public boolean checkState(int tries) throws IOException { return !getAdmin().tableExists(tableName); } }); }
/** * @return a description of the operation */ protected String getDescription() { return "Operation: " + getOperationType() + ", " + "Table Name: " + tableName.getNameWithNamespaceInclAsString(); }
@Override protected Void postOperationResult(final Void result, final long deadlineTs) throws IOException, TimeoutException { // Delete cached information to prevent clients from using old locations ((ClusterConnection) getAdmin().getConnection()).clearRegionCache(getTableName()); return super.postOperationResult(result, deadlineTs); } }
@Override public boolean checkState(int tries) throws IOException { return getAdmin().getAlterStatus(tableName).getFirst() == 0; } });
/** * @return the table descriptor */ protected TableDescriptor getTableDescriptor() throws IOException { return getAdmin().getDescriptor(getTableName()); }
protected void waitForAllRegionsOnline(final long deadlineTs, final byte[][] splitKeys) throws IOException, TimeoutException { final TableDescriptor desc = getTableDescriptor(); final AtomicInteger actualRegCount = new AtomicInteger(0); final MetaTableAccessor.Visitor visitor = new MetaTableAccessor.Visitor() { while (EnvironmentEdgeManager.currentTime() < deadlineTs) { actualRegCount.set(0); MetaTableAccessor.scanMetaForTableRegions(getAdmin().getConnection(), visitor, desc.getTableName()); if (actualRegCount.get() == numRegs) { Thread.sleep(getAdmin().getPauseTime(tries++)); } catch (InterruptedException e) { throw new InterruptedIOException("Interrupted when opening" + " regions; "
protected void waitForTableEnabled(final long deadlineTs) throws IOException, TimeoutException { waitForState(deadlineTs, new TableWaitForStateCallable() { @Override public boolean checkState(int tries) throws IOException { try { if (getAdmin().isTableAvailable(tableName)) { return true; } } catch (TableNotFoundException tnfe) { LOG.debug("Table " + tableName.getNameWithNamespaceInclAsString() + " was not enabled, sleeping. tries=" + tries); } return false; } }); }
@Override public boolean checkState(int tries) throws IOException { try { if (getAdmin().isTableAvailable(tableName)) { return true; } } catch (TableNotFoundException tnfe) { LOG.debug("Table " + tableName.getNameWithNamespaceInclAsString() + " was not enabled, sleeping. tries=" + tries); } return false; } });