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

项目:ditb    文件:HRegion.java   
private void checkResources() throws RegionTooBusyException {
  // If catalog region, do not impose resource constraints or block updates.
  if (this.getRegionInfo().isMetaRegion()) return;

  if (this.memstoreSize.get() > this.blockingMemStoreSize) {
    blockedRequestsCount.increment();
    requestFlush();
    throw new RegionTooBusyException(
        "Above memstore limit, " + "regionName=" + (this.getRegionInfo() == null ?
            "unknown" :
            this.getRegionInfo().getRegionNameAsString()) + ", server=" + (
            this.getRegionServerServices() == null ?
                "unknown" :
                this.getRegionServerServices().getServerName()) + ", memstoreSize=" + memstoreSize
            .get() + ", blockingMemStoreSize=" + blockingMemStoreSize);
  }
}
项目:pbase    文件:HRegion.java   
private void checkResources()
        throws RegionTooBusyException {
    // If catalog region, do not impose resource constraints or block updates.
    if (this.getRegionInfo().isMetaRegion()) return;
    //缓存空间
    if (this.memstoreSize.get() > this.blockingMemStoreSize) {
        blockedRequestsCount.increment();
        requestFlush();
        throw new RegionTooBusyException("Above memstore limit, " +
                "regionName=" + (this.getRegionInfo() == null ? "unknown" :
                this.getRegionInfo().getRegionNameAsString()) +
                ", server=" + (this.getRegionServerServices() == null ? "unknown" :
                this.getRegionServerServices().getServerName()) +
                ", memstoreSize=" + memstoreSize.get() +
                ", blockingMemStoreSize=" + blockingMemStoreSize);
    }
}
项目:HIndex    文件:HRegion.java   
public void checkResources()
  throws RegionTooBusyException {
  // If catalog region, do not impose resource constraints or block updates.
  if (this.getRegionInfo().isMetaRegion()) return;

  if (this.memstoreSize.get() > this.blockingMemStoreSize) {
    requestFlush();
    throw new RegionTooBusyException("Above memstore limit, " +
        "regionName=" + (this.getRegionInfo() == null ? "unknown" :
        this.getRegionInfo().getRegionNameAsString()) +
        ", server=" + (this.getRegionServerServices() == null ? "unknown" :
        this.getRegionServerServices().getServerName()) +
        ", memstoreSize=" + memstoreSize.get() +
        ", blockingMemStoreSize=" + blockingMemStoreSize);
  }
}
项目:IRIndex    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closed");
  }
}
项目:hbase    文件:HRegion.java   
void checkResources() throws RegionTooBusyException {
  // If catalog region, do not impose resource constraints or block updates.
  if (this.getRegionInfo().isMetaRegion()) return;

  if (this.memstoreDataSize.get() > this.blockingMemStoreSize) {
    blockedRequestsCount.increment();
    requestFlush();
    // Don't print current limit because it will vary too much. The message is used as a key
    // over in RetriesExhaustedWithDetailsException processing.
    throw new RegionTooBusyException("Over memstore limit; regionName=" +
        (this.getRegionInfo() == null? "unknown": this.getRegionInfo().getEncodedName()) +
        ", server=" + (this.getRegionServerServices() == null ? "unknown":
        this.getRegionServerServices().getServerName()) +
        ", blockingMemStoreSize=" +
        org.apache.hadoop.hbase.procedure2.util.StringUtils.humanSize(blockingMemStoreSize));
  }
}
项目:hbase    文件:RetriesExhaustedWithDetailsException.java   
public static Map<String, Integer> classifyExs(List<Throwable> ths) {
  Map<String, Integer> cls = new HashMap<>();
  for (Throwable t : ths) {
    if (t == null) continue;
    String name = "";
    if (t instanceof DoNotRetryIOException ||
        t instanceof RegionTooBusyException) {
      // If RegionTooBusyException, print message since it has Region name in it.
      // RegionTooBusyException message was edited to remove variance. Has regionname, server,
      // and why the exception; no longer has duration it waited on lock nor current memsize.
      name = t.getMessage();
    } else {
      name = t.getClass().getSimpleName();
    }
    Integer i = cls.get(name);
    if (i == null) {
      i = 0;
    }
    i += 1;
    cls.put(name, i);
  }
  return cls;
}
项目:PyroDB    文件:HRegion.java   
private void checkResources()
  throws RegionTooBusyException {
  // If catalog region, do not impose resource constraints or block updates.
  if (this.getRegionInfo().isMetaRegion()) return;

  if (this.memstoreSize.get() > this.blockingMemStoreSize) {
    requestFlush();
    throw new RegionTooBusyException("Above memstore limit, " +
        "regionName=" + (this.getRegionInfo() == null ? "unknown" :
        this.getRegionInfo().getRegionNameAsString()) +
        ", server=" + (this.getRegionServerServices() == null ? "unknown" :
        this.getRegionServerServices().getServerName()) +
        ", memstoreSize=" + memstoreSize.get() +
        ", blockingMemStoreSize=" + blockingMemStoreSize);
  }
}
项目:c5    文件:HRegion.java   
private void checkResources()
  throws RegionTooBusyException {
  // If catalog region, do not impose resource constraints or block updates.
  if (this.getRegionInfo().isMetaRegion()) return;

  if (this.memstoreSize.get() > this.blockingMemStoreSize) {
    requestFlush();
    throw new RegionTooBusyException("Above memstore limit, " +
        "regionName=" + (this.getRegionInfo() == null ? "unknown" :
        this.getRegionInfo().getRegionNameAsString()) +
        ", server=" + (this.getRegionServerServices() == null ? "unknown" :
        this.getRegionServerServices().getServerName()) +
        ", memstoreSize=" + memstoreSize.get() +
        ", blockingMemStoreSize=" + blockingMemStoreSize);
  }
}
项目:HBase-Research    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closed");
  }
}
项目:hbase-0.94.8-qod    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closed");
  }
}
项目:hbase-0.94.8-qod    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closed");
  }
}
项目:DominoHBase    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closed");
  }
}
项目:hindex    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closed");
  }
}
项目:ditb    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or modifies stores in bulk. It
 * has to be called just before a try. #closeBulkRegionOperation needs to be called in the try's
 * finally block Acquires a writelock and checks if the region is closing or closed.
 *
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException    if failed to get the lock in time
 * @throws InterruptedIOException    if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " is closed");
  }
}
项目:ditb    文件:MetricsHBaseServer.java   
public void exception(Throwable throwable) {
  source.exception();

  /**
   * Keep some metrics for commonly seen exceptions
   *
   * Try and  put the most common types first.
   * Place child types before the parent type that they extend.
   *
   * If this gets much larger we might have to go to a hashmap
   */
  if (throwable != null) {
    if (throwable instanceof OutOfOrderScannerNextException) {
      source.outOfOrderException();
    } else if (throwable instanceof RegionTooBusyException) {
      source.tooBusyException();
    } else if (throwable instanceof UnknownScannerException) {
      source.unknownScannerException();
    } else if (throwable instanceof RegionMovedException) {
      source.movedRegionException();
    } else if (throwable instanceof NotServingRegionException) {
      source.notServingRegionException();
    } else if (throwable instanceof FailedSanityCheckException) {
      source.failedSanityException();
    } else if (throwable instanceof MultiActionResultTooLarge) {
      source.multiActionTooLargeException();
    }
  }
}
项目:ditb    文件:ClientExceptionsUtil.java   
/**
 * Look for an exception we know in the remote exception:
 * - hadoop.ipc wrapped exceptions
 * - nested exceptions
 *
 * Looks for: RegionMovedException / RegionOpeningException / RegionTooBusyException /
 *            ThrottlingException
 * @return null if we didn't find the exception, the exception otherwise.
 */
public static Throwable findException(Object exception) {
  if (exception == null || !(exception instanceof Throwable)) {
    return null;
  }
  Throwable cur = (Throwable) exception;
  while (cur != null) {
    if (isSpecialException(cur)) {
      return cur;
    }
    if (cur instanceof RemoteException) {
      RemoteException re = (RemoteException) cur;
      cur = re.unwrapRemoteException(
          RegionOpeningException.class, RegionMovedException.class,
          RegionTooBusyException.class);
      if (cur == null) {
        cur = re.unwrapRemoteException();
      }
      // unwrapRemoteException can return the exception given as a parameter when it cannot
      //  unwrap it. In this case, there is no need to look further
      // noinspection ObjectEquality
      if (cur == re) {
        return cur;
      }
    } else if (cur.getCause() != null) {
      cur = cur.getCause();
    } else {
      return cur;
    }
  }

  return null;
}
项目:ditb    文件:TestClientNoCluster.java   
@Override
public MultiResponse multi(RpcController controller, MultiRequest request)
throws ServiceException {
  int concurrentInvocations = this.multiInvocationsCount.incrementAndGet();
  try {
    if (concurrentInvocations >= tooManyMultiRequests) {
      throw new ServiceException(new RegionTooBusyException("concurrentInvocations=" +
       concurrentInvocations));
    }
    Threads.sleep(multiPause);
    return doMultiResponse(meta, sequenceids, request);
  } finally {
    this.multiInvocationsCount.decrementAndGet();
  }
}
项目:LCIndex-HBase-0.94.16    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or modifies data. It has to be
 * called just before a try. #closeRegionOperation needs to be called in the try's finally block
 * Acquires a read lock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
public void startRegionOperation() throws NotServingRegionException, RegionTooBusyException,
    InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() + " is closing");
  }
  lock(lock.readLock());
  if (this.closed.get()) {
    lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() + " is closed");
  }
}
项目:LCIndex-HBase-0.94.16    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or modifies stores in bulk. It
 * has to be called just before a try. #closeBulkRegionOperation needs to be called in the try's
 * finally block Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded) throws NotServingRegionException,
    RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() + " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() + " is closed");
  }
}
项目:pbase    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 *
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException    if failed to get the lock in time
 * @throws InterruptedIOException    if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
        throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
    if (this.closing.get()) {
        throw new NotServingRegionException(getRegionNameAsString() + " is closing");
    }
    if (writeLockNeeded) lock(lock.writeLock());
    else lock(lock.readLock());
    if (this.closed.get()) {
        if (writeLockNeeded) lock.writeLock().unlock();
        else lock.readLock().unlock();
        throw new NotServingRegionException(getRegionNameAsString() + " is closed");
    }
}
项目:pbase    文件:ConnectionManager.java   
/**
 * Look for an exception we know in the remote exception:
 * - hadoop.ipc wrapped exceptions
 * - nested exceptions
 * <p/>
 * Looks for: RegionMovedException / RegionOpeningException / RegionTooBusyException
 *
 * @return null if we didn't find the exception, the exception otherwise.
 */
public static Throwable findException(Object exception) {
    if (exception == null || !(exception instanceof Throwable)) {
        return null;
    }
    Throwable cur = (Throwable) exception;
    while (cur != null) {
        if (cur instanceof RegionMovedException || cur instanceof RegionOpeningException
                || cur instanceof RegionTooBusyException) {
            return cur;
        }
        if (cur instanceof RemoteException) {
            RemoteException re = (RemoteException) cur;
            cur = re.unwrapRemoteException(
                    RegionOpeningException.class, RegionMovedException.class,
                    RegionTooBusyException.class);
            if (cur == null) {
                cur = re.unwrapRemoteException();
            }
            // unwrapRemoteException can return the exception given as a parameter when it cannot
            //  unwrap it. In this case, there is no need to look further
            // noinspection ObjectEquality
            if (cur == re) {
                return null;
            }
        } else {
            cur = cur.getCause();
        }
    }

    return null;
}
项目:pbase    文件:TestClientNoCluster.java   
@Override
public MultiResponse multi(RpcController controller, MultiRequest request)
throws ServiceException {
  int concurrentInvocations = this.multiInvocationsCount.incrementAndGet();
  try {
    if (concurrentInvocations >= tooManyMultiRequests) {
      throw new ServiceException(new RegionTooBusyException("concurrentInvocations=" +
       concurrentInvocations));
    }
    Threads.sleep(multiPause);
    return doMultiResponse(meta, sequenceids, request);
  } finally {
    this.multiInvocationsCount.decrementAndGet();
  }
}
项目:HIndex    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(getRegionNameAsString() + " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(getRegionNameAsString() + " is closed");
  }
}
项目:HIndex    文件:HConnectionManager.java   
/**
 * Look for an exception we know in the remote exception:
 * - hadoop.ipc wrapped exceptions
 * - nested exceptions
 * 
 * Looks for: RegionMovedException / RegionOpeningException / RegionTooBusyException
 * @return null if we didn't find the exception, the exception otherwise.
 */
public static Throwable findException(Object exception) {
  if (exception == null || !(exception instanceof Throwable)) {
    return null;
  }
  Throwable cur = (Throwable) exception;
  while (cur != null) {
    if (cur instanceof RegionMovedException || cur instanceof RegionOpeningException
        || cur instanceof RegionTooBusyException) {
      return cur;
    }
    if (cur instanceof RemoteException) {
      RemoteException re = (RemoteException) cur;
      cur = re.unwrapRemoteException(
          RegionOpeningException.class, RegionMovedException.class,
          RegionTooBusyException.class);
      if (cur == null) {
        cur = re.unwrapRemoteException();
      }
      // unwrapRemoteException can return the exception given as a parameter when it cannot
      //  unwrap it. In this case, there is no need to look further
      // noinspection ObjectEquality
      if (cur == re) {
        return null;
      }
    } else {
      cur = cur.getCause();
    }
  }

  return null;
}
项目:HIndex    文件:TestClientNoCluster.java   
@Override
public MultiResponse multi(RpcController controller, MultiRequest request)
throws ServiceException {
  int concurrentInvocations = this.multiInvocationsCount.incrementAndGet();
  try {
    if (concurrentInvocations >= tooManyMultiRequests) {
      throw new ServiceException(new RegionTooBusyException("concurrentInvocations=" +
       concurrentInvocations));
    }
    Threads.sleep(multiPause);
    return doMultiResponse(meta, sequenceids, request);
  } finally {
    this.multiInvocationsCount.decrementAndGet();
  }
}
项目:IRIndex    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies data. It has to be called just before a try.
 * #closeRegionOperation needs to be called in the try's finally block
 * Acquires a read lock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
public void startRegionOperation()
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closing");
  }
  lock(lock.readLock());
  if (this.closed.get()) {
    lock.readLock().unlock();
    throw new NotServingRegionException(regionInfo.getRegionNameAsString() +
        " is closed");
  }
}
项目:hbase    文件:ThriftMetrics.java   
/**
 * Increment the count for a specific exception type.  This is called for each exception type
 * that is returned to the thrift handler.
 * @param rawThrowable type of exception
 */
public void exception(Throwable rawThrowable) {
  source.exception();

  Throwable throwable = unwrap(rawThrowable);
  /**
   * Keep some metrics for commonly seen exceptions
   *
   * Try and  put the most common types first.
   * Place child types before the parent type that they extend.
   *
   * If this gets much larger we might have to go to a hashmap
   */
  if (throwable != null) {
    if (throwable instanceof OutOfOrderScannerNextException) {
      source.outOfOrderException();
    } else if (throwable instanceof RegionTooBusyException) {
      source.tooBusyException();
    } else if (throwable instanceof UnknownScannerException) {
      source.unknownScannerException();
    } else if (throwable instanceof ScannerResetException) {
      source.scannerResetException();
    } else if (throwable instanceof RegionMovedException) {
      source.movedRegionException();
    } else if (throwable instanceof NotServingRegionException) {
      source.notServingRegionException();
    } else if (throwable instanceof FailedSanityCheckException) {
      source.failedSanityException();
    } else if (throwable instanceof MultiActionResultTooLarge) {
      source.multiActionTooLargeException();
    } else if (throwable instanceof CallQueueTooBigException) {
      source.callQueueTooBigException();
    }
  }
}
项目:hbase    文件:ErrorThrowingGetObserver.java   
@Override
public void preGetOp(ObserverContext<RegionCoprocessorEnvironment> e,
                     Get get, List<Cell> results) throws IOException {
  byte[] errorType = get.getAttribute(SHOULD_ERROR_ATTRIBUTE);
  if (errorType != null) {
    ErrorType type = ErrorType.valueOf(Bytes.toString(errorType));
    switch (type) {
      case CALL_QUEUE_TOO_BIG:
        throw new CallQueueTooBigException("Failing for test");
      case MULTI_ACTION_RESULT_TOO_LARGE:
        throw new MultiActionResultTooLarge("Failing for test");
      case FAILED_SANITY_CHECK:
        throw new FailedSanityCheckException("Failing for test");
      case NOT_SERVING_REGION:
        throw new NotServingRegionException("Failing for test");
      case REGION_MOVED:
        throw new RegionMovedException(e.getEnvironment().getServerName(), 1);
      case SCANNER_RESET:
        throw new ScannerResetException("Failing for test");
      case UNKNOWN_SCANNER:
        throw new UnknownScannerException("Failing for test");
      case REGION_TOO_BUSY:
        throw new RegionTooBusyException("Failing for test");
      case OUT_OF_ORDER_SCANNER_NEXT:
        throw new OutOfOrderScannerNextException("Failing for test");
      default:
        throw new DoNotRetryIOException("Failing for test");
    }
  }
}
项目:hbase    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(getRegionInfo().getRegionNameAsString() + " is closed");
  }
}
项目:hbase    文件:MetricsHBaseServer.java   
public void exception(Throwable throwable) {
  source.exception();

  /**
   * Keep some metrics for commonly seen exceptions
   *
   * Try and  put the most common types first.
   * Place child types before the parent type that they extend.
   *
   * If this gets much larger we might have to go to a hashmap
   */
  if (throwable != null) {
    if (throwable instanceof OutOfOrderScannerNextException) {
      source.outOfOrderException();
    } else if (throwable instanceof RegionTooBusyException) {
      source.tooBusyException();
    } else if (throwable instanceof UnknownScannerException) {
      source.unknownScannerException();
    } else if (throwable instanceof ScannerResetException) {
      source.scannerResetException();
    } else if (throwable instanceof RegionMovedException) {
      source.movedRegionException();
    } else if (throwable instanceof NotServingRegionException) {
      source.notServingRegionException();
    } else if (throwable instanceof FailedSanityCheckException) {
      source.failedSanityException();
    } else if (throwable instanceof MultiActionResultTooLarge) {
      source.multiActionTooLargeException();
    } else if (throwable instanceof CallQueueTooBigException) {
      source.callQueueTooBigException();
    }
  }
}
项目:hbase    文件:ClientExceptionsUtil.java   
public static boolean isSpecialException(Throwable cur) {
  return (cur instanceof RegionMovedException || cur instanceof RegionOpeningException
      || cur instanceof RegionTooBusyException || cur instanceof ThrottlingException
      || cur instanceof MultiActionResultTooLarge || cur instanceof RetryImmediatelyException
      || cur instanceof CallQueueTooBigException || cur instanceof CallDroppedException
      || cur instanceof NotServingRegionException || cur instanceof RequestTooBigException);
}
项目:hbase    文件:TestRetriesExhaustedWithDetailsException.java   
/**
 * Assert that a RetriesExhaustedException that has RegionTooBusyException outputs region name.
 */
@Test
public void testRegionTooBusyException() {
  List<Throwable> ts = new ArrayList<>(1);
  final String regionName = this.name.getMethodName();
  ts.add(new RegionTooBusyException(regionName));
  List<Row> rows = new ArrayList<>(1);
  rows.add(Mockito.mock(Row.class));
  List<String> hostAndPorts = new ArrayList<>(1);
  hostAndPorts.add("example.com:1234");
  RetriesExhaustedException ree =
      new RetriesExhaustedWithDetailsException(ts, rows, hostAndPorts);
  assertTrue(ree.toString().contains(regionName));
}
项目:hbase    文件:TestClientNoCluster.java   
@Override
public MultiResponse multi(RpcController controller, MultiRequest request)
throws ServiceException {
  int concurrentInvocations = this.multiInvocationsCount.incrementAndGet();
  try {
    if (concurrentInvocations >= tooManyMultiRequests) {
      throw new ServiceException(new RegionTooBusyException("concurrentInvocations=" +
       concurrentInvocations));
    }
    Threads.sleep(multiPause);
    return doMultiResponse(meta, sequenceids, request);
  } finally {
    this.multiInvocationsCount.decrementAndGet();
  }
}
项目:PyroDB    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(getRegionNameAsString() + " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(getRegionNameAsString() + " is closed");
  }
}
项目:PyroDB    文件:ConnectionManager.java   
/**
 * Look for an exception we know in the remote exception:
 * - hadoop.ipc wrapped exceptions
 * - nested exceptions
 * 
 * Looks for: RegionMovedException / RegionOpeningException / RegionTooBusyException
 * @return null if we didn't find the exception, the exception otherwise.
 */
public static Throwable findException(Object exception) {
  if (exception == null || !(exception instanceof Throwable)) {
    return null;
  }
  Throwable cur = (Throwable) exception;
  while (cur != null) {
    if (cur instanceof RegionMovedException || cur instanceof RegionOpeningException
        || cur instanceof RegionTooBusyException) {
      return cur;
    }
    if (cur instanceof RemoteException) {
      RemoteException re = (RemoteException) cur;
      cur = re.unwrapRemoteException(
          RegionOpeningException.class, RegionMovedException.class,
          RegionTooBusyException.class);
      if (cur == null) {
        cur = re.unwrapRemoteException();
      }
      // unwrapRemoteException can return the exception given as a parameter when it cannot
      //  unwrap it. In this case, there is no need to look further
      // noinspection ObjectEquality
      if (cur == re) {
        return null;
      }
    } else {
      cur = cur.getCause();
    }
  }

  return null;
}
项目:PyroDB    文件:TestClientNoCluster.java   
@Override
public MultiResponse multi(RpcController controller, MultiRequest request)
throws ServiceException {
  int concurrentInvocations = this.multiInvocationsCount.incrementAndGet();
  try {
    if (concurrentInvocations >= tooManyMultiRequests) {
      throw new ServiceException(new RegionTooBusyException("concurrentInvocations=" +
       concurrentInvocations));
    }
    Threads.sleep(multiPause);
    return doMultiResponse(meta, sequenceids, request);
  } finally {
    this.multiInvocationsCount.decrementAndGet();
  }
}
项目:c5    文件:HRegion.java   
/**
 * @param op The operation is about to be taken on the region
 * @throws NotServingRegionException
 * @throws RegionTooBusyException
 * @throws InterruptedIOException
 */
protected void startRegionOperation(Operation op) throws NotServingRegionException,
    RegionTooBusyException, InterruptedIOException {
  switch (op) {
  case INCREMENT:
  case APPEND:
  case GET:
  case SCAN:
  case SPLIT_REGION:
  case MERGE_REGION:
  case PUT:
  case DELETE:
  case BATCH_MUTATE:
  case COMPACT_REGION:
    // when a region is in recovering state, no read, split or merge is allowed
    if (this.isRecovering() && (this.disallowWritesInRecovering ||
            (op != Operation.PUT && op != Operation.DELETE && op != Operation.BATCH_MUTATE))) {
      throw new RegionInRecoveryException(this.getRegionNameAsString() + " is recovering");
    }
    break;
  default:
    break;
  }
  if (op == Operation.MERGE_REGION || op == Operation.SPLIT_REGION
      || op == Operation.COMPACT_REGION) {
    // split, merge or compact region doesn't need to check the closing/closed state or lock the
    // region
    return;
  }
  if (this.closing.get()) {
    throw new NotServingRegionException(getRegionNameAsString() + " is closing");
  }
  lock(lock.readLock());
  if (this.closed.get()) {
    lock.readLock().unlock();
    throw new NotServingRegionException(getRegionNameAsString() + " is closed");
  }
}
项目:c5    文件:HRegion.java   
/**
 * This method needs to be called before any public call that reads or
 * modifies stores in bulk. It has to be called just before a try.
 * #closeBulkRegionOperation needs to be called in the try's finally block
 * Acquires a writelock and checks if the region is closing or closed.
 * @throws NotServingRegionException when the region is closing or closed
 * @throws RegionTooBusyException if failed to get the lock in time
 * @throws InterruptedIOException if interrupted while waiting for a lock
 */
private void startBulkRegionOperation(boolean writeLockNeeded)
    throws NotServingRegionException, RegionTooBusyException, InterruptedIOException {
  if (this.closing.get()) {
    throw new NotServingRegionException(getRegionNameAsString() + " is closing");
  }
  if (writeLockNeeded) lock(lock.writeLock());
  else lock(lock.readLock());
  if (this.closed.get()) {
    if (writeLockNeeded) lock.writeLock().unlock();
    else lock.readLock().unlock();
    throw new NotServingRegionException(getRegionNameAsString() + " is closed");
  }
}
项目:c5    文件:HConnectionManager.java   
/**
 * Look for an exception we know in the remote exception:
 * - hadoop.ipc wrapped exceptions
 * - nested exceptions
 * 
 * Looks for: RegionMovedException / RegionOpeningException / RegionTooBusyException
 * @return null if we didn't find the exception, the exception otherwise.
 */
public static Throwable findException(Object exception) {
  if (exception == null || !(exception instanceof Throwable)) {
    return null;
  }
  Throwable cur = (Throwable) exception;
  while (cur != null) {
    if (cur instanceof RegionMovedException || cur instanceof RegionOpeningException
        || cur instanceof RegionTooBusyException) {
      return cur;
    }
    if (cur instanceof RemoteException) {
      RemoteException re = (RemoteException) cur;
      cur = re.unwrapRemoteException(
          RegionOpeningException.class, RegionMovedException.class,
          RegionTooBusyException.class);
      if (cur == null) {
        cur = re.unwrapRemoteException();
      }
      // unwrapRemoteException can return the exception given as a parameter when it cannot
      //  unwrap it. In this case, there is no need to look further
      // noinspection ObjectEquality
      if (cur == re) {
        return null;
      }
    } else {
      cur = cur.getCause();
    }
  }

  return null;
}
项目:c5    文件:TestClientNoCluster.java   
@Override
public MultiResponse multi(RpcController controller, MultiRequest request)
throws ServiceException {
  int concurrentInvocations = this.multiInvocationsCount.incrementAndGet();
  try {
    if (concurrentInvocations >= tooManyMultiRequests) {
      throw new ServiceException(new RegionTooBusyException("concurrentInvocations=" +
       concurrentInvocations));
    }
    Threads.sleep(multiPause);
    return doMultiResponse(meta, sequenceids, request);
  } finally {
    this.multiInvocationsCount.decrementAndGet();
  }
}