HBASE-19647 Logging cleanups; emit regionname when RegionTooBusyException inside RetriesExhausted... make netty connect/disconnect TRACE-level; ADDENDUM

This commit is contained in:
Michael Stack 2017-12-27 14:14:07 -08:00
parent 7dee1bcd31
commit e4ab29ada2
5 changed files with 19 additions and 17 deletions

View File

@ -24,21 +24,20 @@ import org.apache.yetus.audience.InterfaceAudience;
/** /**
* Thrown by a region server if it will block and wait to serve a request. * Thrown by a region server if it will block and wait to serve a request.
* For example, the client wants to insert something to a region while the * For example, the client wants to insert something to a region while the
* region is compacting. * region is compacting. Keep variance in the passed 'msg' low because its msg is used as a key
* over in {@link org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException}
* grouping failure types.
*/ */
@InterfaceAudience.Public @InterfaceAudience.Public
public class RegionTooBusyException extends IOException { public class RegionTooBusyException extends IOException {
private static final long serialVersionUID = 1728345723728342L; private static final long serialVersionUID = 1728345723728342L;
/** default constructor */
public RegionTooBusyException() {
super();
}
/** /**
* Constructor * Constructor
* @param msg message * @param msg message
*/ */
// Be careful. Keep variance in the passed 'msg' low because its msg is used as a key over in
// RetriesExhaustedWithDetailsException grouping failure types.
public RegionTooBusyException(final String msg) { public RegionTooBusyException(final String msg) {
super(msg); super(msg);
} }

View File

@ -157,6 +157,8 @@ extends RetriesExhaustedException {
if (t instanceof DoNotRetryIOException || if (t instanceof DoNotRetryIOException ||
t instanceof RegionTooBusyException) { t instanceof RegionTooBusyException) {
// If RegionTooBusyException, print message since it has Region name in it. // 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(); name = t.getMessage();
} else { } else {
name = t.getClass().getSimpleName(); name = t.getClass().getSimpleName();

View File

@ -4170,12 +4170,12 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
if (this.memstoreDataSize.get() > this.blockingMemStoreSize) { if (this.memstoreDataSize.get() > this.blockingMemStoreSize) {
blockedRequestsCount.increment(); blockedRequestsCount.increment();
requestFlush(); requestFlush();
throw new RegionTooBusyException("Over memstore limit, " + // Don't print current limit because it will vary too much. The message is used as a key
"regionName=" + (this.getRegionInfo() == null ? "unknown" : // over in RetriesExhaustedWithDetailsException processing.
this.getRegionInfo().getRegionNameAsString()) + throw new RegionTooBusyException("Over memstore limit; regionName=" +
", server=" + (this.getRegionServerServices() == null ? "unknown" : (this.getRegionInfo() == null? "unknown": this.getRegionInfo().getRegionNameAsString()) +
", server=" + (this.getRegionServerServices() == null ? "unknown":
this.getRegionServerServices().getServerName()) + this.getRegionServerServices().getServerName()) +
", memstoreSize=" + memstoreDataSize.get() +
", blockingMemStoreSize=" + blockingMemStoreSize); ", blockingMemStoreSize=" + blockingMemStoreSize);
} }
} }
@ -8183,11 +8183,12 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
final long waitTime = Math.min(maxBusyWaitDuration, final long waitTime = Math.min(maxBusyWaitDuration,
busyWaitDuration * Math.min(multiplier, maxBusyWaitMultiplier)); busyWaitDuration * Math.min(multiplier, maxBusyWaitMultiplier));
if (!lock.tryLock(waitTime, TimeUnit.MILLISECONDS)) { if (!lock.tryLock(waitTime, TimeUnit.MILLISECONDS)) {
throw new RegionTooBusyException( // Don't print millis. Message is used as a key over in
"failed to get a lock in " + waitTime + " ms. " + // RetriesExhaustedWithDetailsException processing.
"regionName=" + (this.getRegionInfo() == null ? "unknown" : throw new RegionTooBusyException("Failed to obtain lock; regionName=" +
(this.getRegionInfo() == null? "unknown":
this.getRegionInfo().getRegionNameAsString()) + this.getRegionInfo().getRegionNameAsString()) +
", server=" + (this.getRegionServerServices() == null ? "unknown" : ", server=" + (this.getRegionServerServices() == null? "unknown":
this.getRegionServerServices().getServerName())); this.getRegionServerServices().getServerName()));
} }
} catch (InterruptedException ie) { } catch (InterruptedException ie) {

View File

@ -187,7 +187,7 @@ public class TestMetaCache {
public static List<Throwable> metaCachePreservingExceptions() { public static List<Throwable> metaCachePreservingExceptions() {
return new ArrayList<Throwable>() {{ return new ArrayList<Throwable>() {{
add(new RegionOpeningException(" ")); add(new RegionOpeningException(" "));
add(new RegionTooBusyException()); add(new RegionTooBusyException("Some old message"));
add(new ThrottlingException(" ")); add(new ThrottlingException(" "));
add(new MultiActionResultTooLarge(" ")); add(new MultiActionResultTooLarge(" "));
add(new RetryImmediatelyException(" ")); add(new RetryImmediatelyException(" "));

View File

@ -133,7 +133,7 @@ public class TestRpcMetrics {
HELPER.assertCounter("exceptions", 1, serverSource); HELPER.assertCounter("exceptions", 1, serverSource);
mrpc.exception(new RegionMovedException(ServerName.parseServerName("localhost:60020"), 100)); mrpc.exception(new RegionMovedException(ServerName.parseServerName("localhost:60020"), 100));
mrpc.exception(new RegionTooBusyException()); mrpc.exception(new RegionTooBusyException("Some region"));
mrpc.exception(new OutOfOrderScannerNextException()); mrpc.exception(new OutOfOrderScannerNextException());
mrpc.exception(new NotServingRegionException()); mrpc.exception(new NotServingRegionException());
HELPER.assertCounter("exceptions.RegionMovedException", 1, serverSource); HELPER.assertCounter("exceptions.RegionMovedException", 1, serverSource);