本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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();
}
}
}
示例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");
}
}
}