Java 类org.apache.hadoop.hbase.RegionException 实例源码

项目:LCIndex-HBase-0.94.16    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion. May timeout eventually. Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)} instead. The table has
 * to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException There could be couple types of IOException TableNotFoundException means the
 *           table doesn't exist. TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final byte[] tableName) throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " + "disabled in "
          + Bytes.toString(tableName));
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait" + " for the table "
        + Bytes.toString(tableName) + " to be disabled.");
  }
  LOG.info("Disabled " + Bytes.toString(tableName));
}
项目:pbase    文件:TestAssignmentManager.java   
private void createRegionPlanAndBalance(
    final AssignmentManager am, final ServerName from,
    final ServerName to, final HRegionInfo hri) throws RegionException {
  // Call the balance function but fake the region being online first at
  // servername from.
  am.regionOnline(hri, from);
  // Balance region from 'from' to 'to'. It calls unassign setting CLOSING state
  // up in zk.  Create a plan and balance
  am.balance(new RegionPlan(hri, from, to));
}
项目:pbase    文件:TestAssignmentManager.java   
private void unassign(final AssignmentManager am, final ServerName sn,
    final HRegionInfo hri) throws RegionException {
  // Before I can unassign a region, I need to set it online.
  am.regionOnline(hri, sn);
  // Unassign region.
  am.unassign(hri);
}
项目:pbase    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
@Override
public void disableTable(final TableName tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + tableName);
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + tableName + " to be disabled.");
  }
  LOG.info("Disabled " + tableName);
}
项目:HIndex    文件:TestAssignmentManager.java   
private void createRegionPlanAndBalance(
    final AssignmentManager am, final ServerName from,
    final ServerName to, final HRegionInfo hri) throws RegionException {
  // Call the balance function but fake the region being online first at
  // servername from.
  am.regionOnline(hri, from);
  // Balance region from 'from' to 'to'. It calls unassign setting CLOSING state
  // up in zk.  Create a plan and balance
  am.balance(new RegionPlan(hri, from, to));
}
项目:HIndex    文件:TestAssignmentManager.java   
private void unassign(final AssignmentManager am, final ServerName sn,
    final HRegionInfo hri) throws RegionException {
  // Before I can unassign a region, I need to set it online.
  am.regionOnline(hri, sn);
  // Unassign region.
  am.unassign(hri);
}
项目:HIndex    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final TableName tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + tableName);
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + tableName + " to be disabled.");
  }
  LOG.info("Disabled " + tableName);
}
项目:hbase-tools    文件:Merge.java   
/**
 * @param tableInfo
 * @return true: stop iteration, false: continue iteration
 * @throws Exception
 */
private boolean emptyInternal(TableInfo tableInfo) throws Exception {
    tableInfo.refresh();

    Set<HRegionInfo> mergedRegions = new HashSet<>();
    List<HRegionInfo> allTableRegions = new ArrayList<>(tableInfo.getRegionInfoSet());
    for (int i = 0; i < allTableRegions.size(); i++) {
        HRegionInfo region = allTableRegions.get(i);
        if (mergedRegions.contains(region)) continue;

        RegionLoadDelegator regionLoad = tableInfo.getRegionLoad(region);
        if (regionLoad == null) throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);

        HRegionInfo targetRegion = getTargetRegion(tableInfo, allTableRegions, i, mergedRegions);
        if (mergedRegions.contains(targetRegion)) continue;

        if (regionLoad.getStorefileSizeMB() == 0 && regionLoad.getMemStoreSizeMB() == 0) {
            if (CommandAdapter.isReallyEmptyRegion(connection, tableInfo.getTableName(), region)) {
                try {
                    if (targetRegion != null) {
                        printMergeInfo(region, targetRegion);
                        mergedRegions.add(region);
                        mergedRegions.add(targetRegion);
                        CommandAdapter.mergeRegions(args, admin, region, targetRegion);
                        i++;
                    }
                } catch (RegionException e) {
                    throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);
                }
            }
        }
    }

    System.out.println();
    return mergedRegions.size() <= 1;
}
项目:hbase-tools    文件:Merge.java   
/**
 * @param tableInfo
 * @return true: stop iteration, false: continue iteration
 * @throws Exception
 */
private boolean emptyInternal(TableInfo tableInfo) throws Exception {
    tableInfo.refresh();

    Set<HRegionInfo> mergedRegions = new HashSet<>();
    List<HRegionInfo> allTableRegions = new ArrayList<>(tableInfo.getRegionInfoSet());
    for (int i = 0; i < allTableRegions.size(); i++) {
        HRegionInfo region = allTableRegions.get(i);
        if (mergedRegions.contains(region)) continue;

        RegionLoadDelegator regionLoad = tableInfo.getRegionLoad(region);
        if (regionLoad == null) throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);

        HRegionInfo targetRegion = getTargetRegion(tableInfo, allTableRegions, i, mergedRegions);
        if (mergedRegions.contains(targetRegion)) continue;

        if (regionLoad.getStorefileSizeMB() == 0 && regionLoad.getMemStoreSizeMB() == 0) {
            if (CommandAdapter.isReallyEmptyRegion(connection, tableInfo.getTableName(), region)) {
                try {
                    if (targetRegion != null) {
                        printMergeInfo(region, targetRegion);
                        mergedRegions.add(region);
                        mergedRegions.add(targetRegion);
                        CommandAdapter.mergeRegions(args, admin, region, targetRegion);
                        i++;
                    }
                } catch (RegionException e) {
                    throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);
                }
            }
        }
    }

    System.out.println();
    return mergedRegions.size() <= 1;
}
项目:hbase-tools    文件:Merge.java   
/**
 * @param tableInfo
 * @return true: stop iteration, false: continue iteration
 * @throws Exception
 */
private boolean emptyInternal(TableInfo tableInfo) throws Exception {
    tableInfo.refresh();

    Set<HRegionInfo> mergedRegions = new HashSet<>();
    List<HRegionInfo> allTableRegions = new ArrayList<>(tableInfo.getRegionInfoSet());
    for (int i = 0; i < allTableRegions.size(); i++) {
        HRegionInfo region = allTableRegions.get(i);
        if (mergedRegions.contains(region)) continue;

        RegionLoadDelegator regionLoad = tableInfo.getRegionLoad(region);
        if (regionLoad == null) throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);

        HRegionInfo targetRegion = getTargetRegion(tableInfo, allTableRegions, i, mergedRegions);
        if (mergedRegions.contains(targetRegion)) continue;

        if (regionLoad.getStorefileSizeMB() == 0 && regionLoad.getMemStoreSizeMB() == 0) {
            if (CommandAdapter.isReallyEmptyRegion(connection, tableInfo.getTableName(), region)) {
                try {
                    if (targetRegion != null) {
                        printMergeInfo(region, targetRegion);
                        mergedRegions.add(region);
                        mergedRegions.add(targetRegion);
                        CommandAdapter.mergeRegions(args, admin, region, targetRegion);
                        i++;
                    }
                } catch (RegionException e) {
                    throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);
                }
            }
        }
    }

    System.out.println();
    return mergedRegions.size() <= 1;
}
项目:hbase-tools    文件:Merge.java   
/**
 * @param tableInfo
 * @return true: stop iteration, false: continue iteration
 * @throws Exception
 */
private boolean emptyInternal(TableInfo tableInfo) throws Exception {
    tableInfo.refresh();

    Set<HRegionInfo> mergedRegions = new HashSet<>();
    List<HRegionInfo> allTableRegions = new ArrayList<>(tableInfo.getRegionInfoSet());
    for (int i = 0; i < allTableRegions.size(); i++) {
        HRegionInfo region = allTableRegions.get(i);
        if (mergedRegions.contains(region)) continue;

        RegionLoadDelegator regionLoad = tableInfo.getRegionLoad(region);
        if (regionLoad == null) throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);

        HRegionInfo targetRegion = getTargetRegion(tableInfo, allTableRegions, i, mergedRegions);
        if (mergedRegions.contains(targetRegion)) continue;

        if (regionLoad.getStorefileSizeMB() == 0 && regionLoad.getMemStoreSizeMB() == 0) {
            if (CommandAdapter.isReallyEmptyRegion(connection, tableInfo.getTableName(), region)) {
                try {
                    if (targetRegion != null) {
                        printMergeInfo(region, targetRegion);
                        mergedRegions.add(region);
                        mergedRegions.add(targetRegion);
                        CommandAdapter.mergeRegions(args, admin, region, targetRegion);
                        i++;
                    }
                } catch (RegionException e) {
                    throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);
                }
            }
        }
    }

    System.out.println();
    return mergedRegions.size() <= 1;
}
项目:hbase-tools    文件:Merge.java   
/**
 * @param tableInfo
 * @return true: stop iteration, false: continue iteration
 * @throws Exception
 */
private boolean emptyInternal(TableInfo tableInfo) throws Exception {
    tableInfo.refresh();

    Set<HRegionInfo> mergedRegions = new HashSet<>();
    List<HRegionInfo> allTableRegions = new ArrayList<>(tableInfo.getRegionInfoSet());
    for (int i = 0; i < allTableRegions.size(); i++) {
        HRegionInfo region = allTableRegions.get(i);
        if (mergedRegions.contains(region)) continue;

        RegionLoadDelegator regionLoad = tableInfo.getRegionLoad(region);
        if (regionLoad == null) throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);

        HRegionInfo targetRegion = getTargetRegion(tableInfo, allTableRegions, i, mergedRegions);
        if (mergedRegions.contains(targetRegion)) continue;

        if (regionLoad.getStorefileSizeMB() == 0 && regionLoad.getMemStoreSizeMB() == 0) {
            if (CommandAdapter.isReallyEmptyRegion(connection, tableInfo.getTableName(), region)) {
                try {
                    if (targetRegion != null) {
                        printMergeInfo(region, targetRegion);
                        mergedRegions.add(region);
                        mergedRegions.add(targetRegion);
                        CommandAdapter.mergeRegions(args, admin, region, targetRegion);
                        i++;
                    }
                } catch (RegionException e) {
                    throw new IllegalStateException(Constant.MESSAGE_NEED_REFRESH);
                }
            }
        }
    }

    System.out.println();
    return mergedRegions.size() <= 1;
}
项目:IRIndex    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final byte [] tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + Bytes.toString(tableName));
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + Bytes.toString(tableName) + " to be disabled.");
  }
  LOG.info("Disabled " + Bytes.toString(tableName));
}
项目:hbase    文件:AssignmentManager.java   
@VisibleForTesting
// TODO: Remove this?
public boolean waitForAssignment(final RegionInfo regionInfo, final long timeout)
throws IOException {
  RegionStateNode node = null;
  // This method can be called before the regionInfo has made it into the regionStateMap
  // so wait around here a while.
  long startTime = System.currentTimeMillis();
  // Something badly wrong if takes ten seconds to register a region.
  long endTime = startTime + 10000;
  while ((node = regionStates.getRegionStateNode(regionInfo)) == null && isRunning() &&
      System.currentTimeMillis() < endTime) {
    // Presume it not yet added but will be added soon. Let it spew a lot so we can tell if
    // we are waiting here alot.
    LOG.debug("Waiting on " + regionInfo + " to be added to regionStateMap");
    Threads.sleep(10);
  }
  if (node == null) {
    if (!isRunning()) return false;
    throw new RegionException(regionInfo.getRegionNameAsString() + " never registered with Assigment.");
  }

  RegionTransitionProcedure proc = node.getProcedure();
  if (proc == null) {
    throw new NoSuchProcedureException(node.toString());
  }

  ProcedureSyncWait.waitForProcedureToCompleteIOE(
    master.getMasterProcedureExecutor(), proc, timeout);
  return true;
}
项目:RStore    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final byte [] tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + Bytes.toString(tableName));
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + Bytes.toString(tableName) + " to be disabled.");
  }
  LOG.info("Disabled " + Bytes.toString(tableName));
}
项目:PyroDB    文件:TestAssignmentManager.java   
private void createRegionPlanAndBalance(
    final AssignmentManager am, final ServerName from,
    final ServerName to, final HRegionInfo hri) throws RegionException {
  // Call the balance function but fake the region being online first at
  // servername from.
  am.regionOnline(hri, from);
  // Balance region from 'from' to 'to'. It calls unassign setting CLOSING state
  // up in zk.  Create a plan and balance
  am.balance(new RegionPlan(hri, from, to));
}
项目:PyroDB    文件:TestAssignmentManager.java   
private void unassign(final AssignmentManager am, final ServerName sn,
    final HRegionInfo hri) throws RegionException {
  // Before I can unassign a region, I need to set it online.
  am.regionOnline(hri, sn);
  // Unassign region.
  am.unassign(hri);
}
项目:PyroDB    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final TableName tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + tableName);
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      throw (InterruptedIOException)new InterruptedIOException("Interrupted").initCause(e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + tableName + " to be disabled.");
  }
  LOG.info("Disabled " + tableName);
}
项目:c5    文件:TestAssignmentManager.java   
private void createRegionPlanAndBalance(
    final AssignmentManager am, final ServerName from,
    final ServerName to, final HRegionInfo hri) throws RegionException {
  // Call the balance function but fake the region being online first at
  // servername from.
  am.regionOnline(hri, from);
  // Balance region from 'from' to 'to'. It calls unassign setting CLOSING state
  // up in zk.  Create a plan and balance
  am.balance(new RegionPlan(hri, from, to));
}
项目:c5    文件:TestAssignmentManager.java   
private void unassign(final AssignmentManager am, final ServerName sn,
    final HRegionInfo hri) throws RegionException {
  // Before I can unassign a region, I need to set it online.
  am.regionOnline(hri, sn);
  // Unassign region.
  am.unassign(hri);
}
项目:c5    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final TableName tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + tableName);
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + tableName + " to be disabled.");
  }
  LOG.info("Disabled " + tableName);
}
项目:HBase-Research    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final byte [] tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + Bytes.toString(tableName));
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + Bytes.toString(tableName) + " to be disabled.");
  }
  LOG.info("Disabled " + Bytes.toString(tableName));
}
项目:hbase-0.94.8-qod    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final byte [] tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + Bytes.toString(tableName));
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + Bytes.toString(tableName) + " to be disabled.");
  }
  LOG.info("Disabled " + Bytes.toString(tableName));
}
项目:hbase-0.94.8-qod    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final byte [] tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + Bytes.toString(tableName));
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + Bytes.toString(tableName) + " to be disabled.");
  }
  LOG.info("Disabled " + Bytes.toString(tableName));
}
项目:DominoHBase    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final byte [] tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + Bytes.toString(tableName));
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + Bytes.toString(tableName) + " to be disabled.");
  }
  LOG.info("Disabled " + Bytes.toString(tableName));
}
项目:DominoHBase    文件:TestAssignmentManager.java   
private void createRegionPlanAndBalance(
    final AssignmentManager am, final ServerName from,
    final ServerName to, final HRegionInfo hri) throws RegionException {
  // Call the balance function but fake the region being online first at
  // servername from.
  am.regionOnline(hri, from);
  // Balance region from 'from' to 'to'. It calls unassign setting CLOSING state
  // up in zk.  Create a plan and balance
  am.balance(new RegionPlan(hri, from, to));
}
项目:DominoHBase    文件:TestAssignmentManager.java   
private void unassign(final AssignmentManager am, final ServerName sn,
    final HRegionInfo hri) throws RegionException {
  // Before I can unassign a region, I need to set it online.
  am.regionOnline(hri, sn);
  // Unassign region.
  am.unassign(hri);
}
项目:hindex    文件:HBaseAdmin.java   
/**
 * Disable table and wait on completion.  May timeout eventually.  Use
 * {@link #disableTableAsync(byte[])} and {@link #isTableDisabled(String)}
 * instead.
 * The table has to be in enabled state for it to be disabled.
 * @param tableName
 * @throws IOException
 * There could be couple types of IOException
 * TableNotFoundException means the table doesn't exist.
 * TableNotEnabledException means the table isn't in enabled state.
 */
public void disableTable(final byte [] tableName)
throws IOException {
  disableTableAsync(tableName);
  // Wait until table is disabled
  boolean disabled = false;
  for (int tries = 0; tries < (this.numRetries * this.retryLongerMultiplier); tries++) {
    disabled = isTableDisabled(tableName);
    if (disabled) {
      break;
    }
    long sleep = getPauseTime(tries);
    if (LOG.isDebugEnabled()) {
      LOG.debug("Sleeping= " + sleep + "ms, waiting for all regions to be " +
        "disabled in " + Bytes.toString(tableName));
    }
    try {
      Thread.sleep(sleep);
    } catch (InterruptedException e) {
      // Do this conversion rather than let it out because do not want to
      // change the method signature.
      Thread.currentThread().interrupt();
      throw new IOException("Interrupted", e);
    }
  }
  if (!disabled) {
    throw new RegionException("Retries exhausted, it took too long to wait"+
      " for the table " + Bytes.toString(tableName) + " to be disabled.");
  }
  LOG.info("Disabled " + Bytes.toString(tableName));
}