Exemplo n.º 1
0
  /**
   * Wait on region to clear regions-in-transition.
   *
   * <p>If the region isn't in transition, returns immediately. Otherwise, method blocks until the
   * region is out of transition.
   */
  public synchronized void waitOnRegionToClearRegionsInTransition(final HRegionInfo hri)
      throws InterruptedException {
    if (!isRegionInTransition(hri)) return;

    while (!server.isStopped() && isRegionInTransition(hri)) {
      RegionState rs = getRegionState(hri);
      LOG.info("Waiting on " + rs + " to clear regions-in-transition");
      waitForUpdate(100);
    }

    if (server.isStopped()) {
      LOG.info("Giving up wait on region in " + "transition because stoppable.isStopped is set");
    }
  }
Exemplo n.º 2
0
 /**
  * Unassign the list of regions. Configuration knobs: hbase.bulk.waitbetween.reopen indicates the
  * number of milliseconds to wait before unassigning another region from this region server
  *
  * @param regions
  * @throws InterruptedException
  */
 private void unassign(List<HRegionInfo> regions) throws InterruptedException {
   int waitTime = this.server.getConfiguration().getInt("hbase.bulk.waitbetween.reopen", 0);
   RegionStates regionStates = assignmentManager.getRegionStates();
   for (HRegionInfo region : regions) {
     if (server.isStopped()) {
       return;
     }
     if (regionStates.isRegionInTransition(region)) {
       continue;
     }
     assignmentManager.unassign(region);
     while (regionStates.isRegionInTransition(region) && !server.isStopped()) {
       regionStates.waitForUpdate(100);
     }
     if (waitTime > 0 && !server.isStopped()) {
       Thread.sleep(waitTime);
     }
   }
 }