当前位置: 首页>>代码示例>>Java>>正文


Java RegionMovedException类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.exceptions.RegionMovedException的典型用法代码示例。如果您正苦于以下问题:Java RegionMovedException类的具体用法?Java RegionMovedException怎么用?Java RegionMovedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RegionMovedException类属于org.apache.hadoop.hbase.exceptions包,在下文中一共展示了RegionMovedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRegionByEncodedName

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
protected Region getRegionByEncodedName(byte[] regionName, String encodedRegionName)
    throws NotServingRegionException {
  Region region = this.onlineRegions.get(encodedRegionName);
  if (region == null) {
    MovedRegionInfo moveInfo = getMovedRegion(encodedRegionName);
    if (moveInfo != null) {
      throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
    }
    Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
    String regionNameStr =
        regionName == null ? encodedRegionName : Bytes.toStringBinary(regionName);
    if (isOpening != null && isOpening.booleanValue()) {
      throw new RegionOpeningException(
          "Region " + regionNameStr + " is opening on " + this.serverName);
    }
    throw new NotServingRegionException(
        "Region " + regionNameStr + " is not online on " + this.serverName);
  }
  return region;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:HRegionServer.java

示例2: getRegionByEncodedName

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
protected HRegion getRegionByEncodedName(byte[] regionName, String encodedRegionName)
        throws NotServingRegionException {
    HRegion region = this.onlineRegions.get(encodedRegionName);
    if (region == null) {
        MovedRegionInfo moveInfo = getMovedRegion(encodedRegionName);
        if (moveInfo != null) {
            throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
        }
        Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
        String regionNameStr = regionName == null ?
                encodedRegionName : Bytes.toStringBinary(regionName);
        if (isOpening != null && isOpening.booleanValue()) {
            throw new RegionOpeningException("Region " + regionNameStr +
                    " is opening on " + this.serverName);
        }
        throw new NotServingRegionException("Region " + regionNameStr +
                " is not online on " + this.serverName);
    }
    return region;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:21,代码来源:HRegionServer.java

示例3: throwable

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
@Override
public void throwable(Throwable t, boolean retrying) {
  if (t instanceof SocketTimeoutException ||
      t instanceof ConnectException ||
      t instanceof RetriesExhaustedException ||
      (location != null && getConnection().isDeadServer(location.getServerName()))) {
    // if thrown these exceptions, we clear all the cache entries that
    // map to that slow/dead server; otherwise, let cache miss and ask
    // hbase:meta again to find the new location
    if (this.location != null) getConnection().clearCaches(location.getServerName());
  } else if (t instanceof RegionMovedException) {
    getConnection().updateCachedLocations(tableName, row, t, location);
  } else if (t instanceof NotServingRegionException && !retrying) {
    // Purge cache entries for this specific region from hbase:meta cache
    // since we don't call connect(true) when number of retries is 1.
    getConnection().deleteCachedRegionLocation(location);
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:19,代码来源:RegionServerCallable.java

示例4: getRegionByEncodedName

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
protected HRegion getRegionByEncodedName(byte[] regionName, String encodedRegionName)
  throws NotServingRegionException {
  HRegion region = this.onlineRegions.get(encodedRegionName);
  if (region == null) {
    MovedRegionInfo moveInfo = getMovedRegion(encodedRegionName);
    if (moveInfo != null) {
      throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
    }
    Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
    String regionNameStr = regionName == null?
      encodedRegionName: Bytes.toStringBinary(regionName);
    if (isOpening != null && isOpening.booleanValue()) {
      throw new RegionOpeningException("Region " + regionNameStr + 
        " is opening on " + this.serverNameFromMasterPOV);
    }
    throw new NotServingRegionException("Region " + regionNameStr + 
      " is not online on " + this.serverNameFromMasterPOV);
  }
  return region;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:21,代码来源:HRegionServer.java

示例5: getRegionByEncodedName

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
protected HRegion getRegionByEncodedName(byte[] regionName, String encodedRegionName)
  throws NotServingRegionException {
  HRegion region = this.onlineRegions.get(encodedRegionName);
  if (region == null) {
    MovedRegionInfo moveInfo = getMovedRegion(encodedRegionName);
    if (moveInfo != null) {
      throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
    }
    Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
    String regionNameStr = regionName == null?
      encodedRegionName: Bytes.toStringBinary(regionName);
    if (isOpening != null && isOpening.booleanValue()) {
      throw new RegionOpeningException("Region " + regionNameStr +
        " is opening on " + this.serverName);
    }
    throw new NotServingRegionException("" + regionNameStr +
      " is not online on " + this.serverName);
  }
  return region;
}
 
开发者ID:apache,项目名称:hbase,代码行数:21,代码来源:HRegionServer.java

示例6: setExceptionResponse

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
static void setExceptionResponse(Throwable t, String errorMsg,
    ResponseHeader.Builder headerBuilder) {
  ExceptionResponse.Builder exceptionBuilder = ExceptionResponse.newBuilder();
  exceptionBuilder.setExceptionClassName(t.getClass().getName());
  exceptionBuilder.setStackTrace(errorMsg);
  exceptionBuilder.setDoNotRetry(t instanceof DoNotRetryIOException);
  if (t instanceof RegionMovedException) {
    // Special casing for this exception.  This is only one carrying a payload.
    // Do this instead of build a generic system for allowing exceptions carry
    // any kind of payload.
    RegionMovedException rme = (RegionMovedException)t;
    exceptionBuilder.setHostname(rme.getHostname());
    exceptionBuilder.setPort(rme.getPort());
  }
  // Set the exception as the result of the method invocation.
  headerBuilder.setException(exceptionBuilder.build());
}
 
开发者ID:apache,项目名称:hbase,代码行数:18,代码来源:ServerCall.java

示例7: getRegionByEncodedName

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
protected HRegion getRegionByEncodedName(byte[] regionName, String encodedRegionName)
  throws NotServingRegionException {
  HRegion region = this.onlineRegions.get(encodedRegionName);
  if (region == null) {
    MovedRegionInfo moveInfo = getMovedRegion(encodedRegionName);
    if (moveInfo != null) {
      throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
    }
    Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
    String regionNameStr = regionName == null?
      encodedRegionName: Bytes.toStringBinary(regionName);
    if (isOpening != null && isOpening.booleanValue()) {
      throw new RegionOpeningException("Region " + regionNameStr + 
        " is opening on " + this.serverName);
    }
    throw new NotServingRegionException("Region " + regionNameStr + 
      " is not online on " + this.serverName);
  }
  return region;
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:21,代码来源:HRegionServer.java

示例8: throwable

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
@Override
public void throwable(Throwable t, boolean retrying) {
  if (t instanceof SocketTimeoutException ||
      t instanceof ConnectException ||
      t instanceof RetriesExhaustedException ||
      (location != null && getConnection().isDeadServer(location.getServerName()))) {
    // if thrown these exceptions, we clear all the cache entries that
    // map to that slow/dead server; otherwise, let cache miss and ask
    // hbase:meta again to find the new location
    if (this.location != null) getConnection().clearCaches(location.getServerName());
  } else if (t instanceof RegionMovedException) {
    getConnection().updateCachedLocations(tableName, row, t, location.getServerName());
  } else if (t instanceof NotServingRegionException && !retrying) {
    // Purge cache entries for this specific region from hbase:meta cache
    // since we don't call connect(true) when number of retries is 1.
    getConnection().deleteCachedRegionLocation(location);
  }
}
 
开发者ID:shenli-uiuc,项目名称:PyroDB,代码行数:19,代码来源:RegionServerCallable.java

示例9: getRegionByEncodedName

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
protected HRegion getRegionByEncodedName(byte[] regionName, String encodedRegionName)
  throws NotServingRegionException {
  HRegion region = this.onlineRegions.get(encodedRegionName);
  if (region == null) {
    MovedRegionInfo moveInfo = getMovedRegion(encodedRegionName);
    if (moveInfo != null) {
      throw new RegionMovedException(moveInfo.getServerName(), moveInfo.getSeqNum());
    }
    Boolean isOpening = this.regionsInTransitionInRS.get(Bytes.toBytes(encodedRegionName));
    String regionNameStr = regionName == null?
      encodedRegionName: Bytes.toStringBinary(regionName);
    if (isOpening != null && isOpening.booleanValue()) {
      throw new RegionOpeningException("Region " + regionNameStr + " is opening");
    }
    throw new NotServingRegionException("Region " + regionNameStr + " is not online");
  }
  return region;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:19,代码来源:HRegionServer.java

示例10: throwable

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
@Override
public void throwable(Throwable t, boolean retrying) {
  if (t instanceof SocketTimeoutException ||
      t instanceof ConnectException ||
      t instanceof RetriesExhaustedException ||
      (location != null && getConnection().isDeadServer(location.getServerName()))) {
    // if thrown these exceptions, we clear all the cache entries that
    // map to that slow/dead server; otherwise, let cache miss and ask
    // hbase:meta again to find the new location
    if (this.location != null)
      getConnection().clearCaches(location.getServerName());
  } else if (t instanceof RegionMovedException) {
    getConnection().updateCachedLocations(tableName, row, t, location);
  } else if (t instanceof NotServingRegionException && !retrying) {
    // Purge cache entries for this specific region from hbase:meta cache
    // since we don't call connect(true) when number of retries is 1.
    getConnection().deleteCachedRegionLocation(location);
  }
}
 
开发者ID:jurmous,项目名称:async-hbase-client,代码行数:20,代码来源:AsyncRegionServerCallable.java

示例11: exception

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
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();
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:30,代码来源:MetricsHBaseServer.java

示例12: findException

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:41,代码来源:ConnectionManager.java

示例13: findException

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:40,代码来源:HConnectionManager.java

示例14: exception

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
/**
 * 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();
    }
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:40,代码来源:ThriftMetrics.java

示例15: preGetOp

import org.apache.hadoop.hbase.exceptions.RegionMovedException; //导入依赖的package包/类
@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");
    }
  }
}
 
开发者ID:apache,项目名称:hbase,代码行数:31,代码来源:ErrorThrowingGetObserver.java


注:本文中的org.apache.hadoop.hbase.exceptions.RegionMovedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。