HBASE-21927 Always fail the locate request when error occur

Signed-off-by: Zheng Hu <openinx@gmail.com>
This commit is contained in:
zhangduo 2019-02-20 19:46:57 +08:00
parent bcbbfaebc4
commit 164c250691
4 changed files with 12 additions and 6 deletions

View File

@ -78,7 +78,7 @@ class AsyncMetaRegionLocator {
metaRelocateFuture.getAndSet(null).completeExceptionally(error);
return;
}
LOG.debug("The fetched meta region location is {}" + locs);
LOG.debug("The fetched meta region location is {}", locs);
// Here we update cache before reset future, so it is possible that someone can get a
// stale value. Consider this:
// 1. update cache

View File

@ -45,7 +45,6 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ConcurrentNavigableMap;
import java.util.concurrent.ConcurrentSkipListMap;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.hadoop.hbase.DoNotRetryIOException;
import org.apache.hadoop.hbase.HBaseIOException;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionLocation;
@ -275,7 +274,9 @@ class AsyncNonMetaRegionLocator {
}
synchronized (tableCache) {
tableCache.pendingRequests.remove(req);
if (error instanceof DoNotRetryIOException) {
if (error != null) {
// fail the request itself, no matter whether it is a DoNotRetryIOException, as we have
// already retried several times
CompletableFuture<?> future = tableCache.allRequests.remove(req);
if (future != null) {
future.completeExceptionally(error);

View File

@ -53,12 +53,18 @@ final class AsyncRegionLocatorHelper {
Function<HRegionLocation, HRegionLocation> cachedLocationSupplier,
Consumer<HRegionLocation> addToCache, Consumer<HRegionLocation> removeFromCache) {
HRegionLocation oldLoc = cachedLocationSupplier.apply(loc);
LOG.debug("Try updating {} , the old value is {}", loc, oldLoc, exception);
if (LOG.isDebugEnabled()) {
LOG.debug("Try updating {} , the old value is {}, error={}", loc, oldLoc,
exception != null ? exception.toString() : "none");
}
if (!canUpdateOnError(loc, oldLoc)) {
return;
}
Throwable cause = findException(exception);
LOG.debug("The actual exception when updating {}", loc, cause);
if (LOG.isDebugEnabled()) {
LOG.debug("The actual exception when updating {} is {}", loc,
cause != null ? cause.toString() : "none");
}
if (cause == null || !isMetaClearingException(cause)) {
LOG.debug("Will not update {} because the exception is null or not the one we care about",
loc);

View File

@ -19,7 +19,6 @@
* limitations under the License.
*/
-->
<!-- for testing -->
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>hbase-build-configuration</artifactId>