You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2018/08/08 03:46:56 UTC
asterixdb git commit: [NO ISSUE] Don't log interrupts as WARNings
Repository: asterixdb
Updated Branches:
refs/heads/master 5ea2a4652 -> 0a2fb110d
[NO ISSUE] Don't log interrupts as WARNings
Change-Id: I0e847b8197fa12f1ce235dde404df24196939a83
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2855
Reviewed-by: abdullah alamoudi <ba...@gmail.com>
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/0a2fb110
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/0a2fb110
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/0a2fb110
Branch: refs/heads/master
Commit: 0a2fb110d1e085e88bb603f691aa302614483e93
Parents: 5ea2a46
Author: Michael Blow <mb...@apache.org>
Authored: Tue Aug 7 18:54:26 2018 -0700
Committer: Michael Blow <mb...@apache.org>
Committed: Tue Aug 7 20:46:40 2018 -0700
----------------------------------------------------------------------
.../org/apache/hyracks/api/util/CleanupUtils.java | 13 ++++++++-----
.../org/apache/hyracks/api/util/ExceptionUtils.java | 3 +++
.../control/cc/result/ResultDirectoryService.java | 16 +++++++++-------
.../hyracks/control/cc/work/TaskFailureWork.java | 5 ++++-
.../java/org/apache/hyracks/control/nc/Task.java | 7 ++++---
.../partitions/MaterializingPipelinedPartition.java | 6 ++++--
.../control/nc/work/NotifyTaskFailureWork.java | 6 ++++--
.../storage/common/buffercache/BufferCache.java | 4 +++-
8 files changed, 39 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a2fb110/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
index ea86298..6e6d342 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/CleanupUtils.java
@@ -38,7 +38,8 @@ public class CleanupUtils {
destroyable.destroy();
} catch (Throwable th) { // NOSONAR. Had to be done to satisfy contracts
try {
- LOGGER.log(Level.WARN, "Failure destroying a destroyable resource", th);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(th) ? Level.DEBUG : Level.WARN,
+ "Failure destroying a destroyable resource", th);
} catch (Throwable ignore) { // NOSONAR: Ignore catching Throwable
// NOSONAR Ignore logging failure
}
@@ -65,8 +66,8 @@ public class CleanupUtils {
writer.close();
} catch (Throwable th) { // NOSONAR Will be suppressed
try {
- LOGGER.log(Level.WARN, "Failure closing a closeable resource of class {}",
- writer.getClass().getSimpleName(), th);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(th) ? Level.DEBUG : Level.WARN,
+ "Failure closing a closeable resource of class {}", writer.getClass().getSimpleName(), th);
} catch (Throwable loggingFailure) { // NOSONAR: Ignore catching Throwable
// NOSONAR: Ignore logging failure
}
@@ -90,7 +91,8 @@ public class CleanupUtils {
writer.fail();
} catch (Throwable th) { // NOSONAR Will be suppressed
try {
- LOGGER.log(Level.WARN, "Failure failing " + writer.getClass().getSimpleName(), th);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(th) ? Level.DEBUG : Level.WARN,
+ "Failure failing " + writer.getClass().getSimpleName(), th);
} catch (Throwable loggingFailure) { // NOSONAR: Ignore catching Throwable
// NOSONAR ignore logging failure
}
@@ -114,7 +116,8 @@ public class CleanupUtils {
closable.close();
} catch (Throwable th) { // NOSONAR Will be suppressed
try {
- LOGGER.log(Level.WARN, "Failure closing a closeable resource", th);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(th) ? Level.DEBUG : Level.WARN,
+ "Failure closing a closeable resource", th);
} catch (Throwable loggingFailure) { // NOSONAR: Ignore catching Throwable
// NOSONAR ignore logging failure
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a2fb110/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
index bba0de7..9c0797e 100644
--- a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/util/ExceptionUtils.java
@@ -130,4 +130,7 @@ public class ExceptionUtils {
return current;
}
+ public static boolean causedByInterrupt(Throwable th) {
+ return getRootCause(th) instanceof InterruptedException;
+ }
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a2fb110/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java
index a65ce4c..0e7f6ee 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/result/ResultDirectoryService.java
@@ -40,6 +40,7 @@ import org.apache.hyracks.api.exceptions.HyracksException;
import org.apache.hyracks.api.job.JobId;
import org.apache.hyracks.api.job.JobSpecification;
import org.apache.hyracks.api.job.JobStatus;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.common.result.AbstractResultManager;
import org.apache.hyracks.control.common.result.ResultStateSweeper;
import org.apache.hyracks.control.common.work.IResultCallback;
@@ -146,19 +147,20 @@ public class ResultDirectoryService extends AbstractResultManager implements IRe
@Override
public synchronized void reportJobFailure(JobId jobId, List<Exception> exceptions) {
- LOGGER.log(Level.INFO, "job " + jobId + " failed and is being reported to " + getClass().getSimpleName(),
- exceptions.get(0));
+ Exception ex = exceptions.isEmpty() ? null : exceptions.get(0);
+ Level logLevel = ExceptionUtils.causedByInterrupt(ex) ? Level.DEBUG : Level.INFO;
+ LOGGER.log(logLevel, "job " + jobId + " failed and is being reported to " + getClass().getSimpleName(), ex);
ResultJobRecord rjr = getResultJobRecord(jobId);
- LOGGER.log(Level.INFO, "Result job record is " + rjr);
+ LOGGER.log(logLevel, "Result job record is " + rjr);
if (rjr != null) {
- LOGGER.log(Level.INFO, "Setting exceptions in Result job record");
+ LOGGER.log(logLevel, "Setting exceptions in Result job record");
rjr.fail(exceptions);
}
final JobResultInfo jobResultInfo = jobResultLocations.get(jobId);
- LOGGER.log(Level.INFO, "Job result info is " + jobResultInfo);
+ LOGGER.log(logLevel, "Job result info is " + jobResultInfo);
if (jobResultInfo != null) {
- LOGGER.log(Level.INFO, "Setting exceptions in Job result info");
- jobResultInfo.setException(exceptions.isEmpty() ? null : exceptions.get(0));
+ LOGGER.log(logLevel, "Setting exceptions in Job result info");
+ jobResultInfo.setException(ex);
}
notifyAll();
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a2fb110/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java
index 8c86aff..833066e 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-cc/src/main/java/org/apache/hyracks/control/cc/work/TaskFailureWork.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.hyracks.api.dataflow.TaskAttemptId;
import org.apache.hyracks.api.job.JobId;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.cc.ClusterControllerService;
import org.apache.hyracks.control.cc.job.IJobManager;
import org.apache.hyracks.control.cc.job.JobRun;
@@ -42,7 +43,9 @@ public class TaskFailureWork extends AbstractTaskLifecycleWork {
@Override
protected void performEvent(TaskAttempt ta) {
- LOGGER.log(Level.WARN, "Executing task failure work for " + this, exceptions.get(0));
+ Exception ex = exceptions.get(0);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(ex) ? Level.DEBUG : Level.WARN,
+ "Executing task failure work for " + this, ex);
IJobManager jobManager = ccs.getJobManager();
JobRun run = jobManager.get(jobId);
if (run == null) {
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a2fb110/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
index f6531d7..252fe97 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/Task.java
@@ -355,10 +355,11 @@ public class Task implements IHyracksTaskContext, ICounterContext, Runnable {
if (!exceptions.isEmpty()) {
if (LOGGER.isWarnEnabled()) {
for (int i = 0; i < exceptions.size(); i++) {
- LOGGER.log(Level.WARN,
- "Task " + taskAttemptId + " failed with exception"
+ Exception e = exceptions.get(i);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(e) ? Level.DEBUG : Level.WARN,
+ "Task failed with exception"
+ (exceptions.size() > 1 ? "s (" + (i + 1) + "/" + exceptions.size() + ")" : ""),
- exceptions.get(i));
+ e);
}
}
ExceptionUtils.setNodeIds(exceptions, ncs.getId());
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a2fb110/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
index 37f33a9..96cbc35 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/partitions/MaterializingPipelinedPartition.java
@@ -30,6 +30,7 @@ import org.apache.hyracks.api.io.IFileHandle;
import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.api.partitions.IPartition;
import org.apache.hyracks.api.partitions.PartitionId;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.common.job.PartitionState;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
@@ -89,7 +90,7 @@ public class MaterializingPipelinedPartition implements IFrameWriter, IPartition
Thread thread = Thread.currentThread();
setDataConsumerThread(thread); // Sets the data consumer thread to the current thread.
try {
- thread.setName(MaterializingPipelinedPartition.class.getName() + " " + pid);
+ thread.setName(MaterializingPipelinedPartition.this.getClass().getSimpleName() + " " + pid);
FileReference fRefCopy;
synchronized (MaterializingPipelinedPartition.this) {
while (fRef == null && !eos && !failed) {
@@ -164,7 +165,8 @@ public class MaterializingPipelinedPartition implements IFrameWriter, IPartition
}
}
} catch (Exception e) {
- LOGGER.warn("Failure writing to a frame", e);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(e) ? Level.DEBUG : Level.WARN,
+ "Failure writing to a frame", e);
} finally {
setDataConsumerThread(null); // Sets back the data consumer thread to null.
}
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a2fb110/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java
index 7dbb3c2..b0c60aa 100644
--- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java
+++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-control-nc/src/main/java/org/apache/hyracks/control/nc/work/NotifyTaskFailureWork.java
@@ -23,6 +23,7 @@ import java.util.List;
import org.apache.hyracks.api.dataflow.TaskAttemptId;
import org.apache.hyracks.api.job.JobId;
import org.apache.hyracks.api.result.IResultPartitionManager;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.control.common.work.AbstractWork;
import org.apache.hyracks.control.nc.NodeControllerService;
import org.apache.hyracks.control.nc.Task;
@@ -49,8 +50,9 @@ public class NotifyTaskFailureWork extends AbstractWork {
@Override
public void run() {
- LOGGER.log(Level.WARN, ncs.getId() + " is sending a notification to cc that task " + taskId + " has failed",
- exceptions.get(0));
+ Exception ex = exceptions.get(0);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(ex) ? Level.DEBUG : Level.WARN, "task " + taskId + " has failed",
+ ex);
try {
IResultPartitionManager resultPartitionManager = ncs.getResultPartitionManager();
if (resultPartitionManager != null) {
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/0a2fb110/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
index 5d8a701..f8b9a57 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/BufferCache.java
@@ -46,6 +46,7 @@ import org.apache.hyracks.api.io.IFileHandle;
import org.apache.hyracks.api.io.IIOManager;
import org.apache.hyracks.api.lifecycle.ILifeCycleComponent;
import org.apache.hyracks.api.replication.IIOReplicationManager;
+import org.apache.hyracks.api.util.ExceptionUtils;
import org.apache.hyracks.api.util.IoUtil;
import org.apache.hyracks.storage.common.file.BufferedFileHandle;
import org.apache.hyracks.storage.common.file.IFileMapManager;
@@ -193,7 +194,8 @@ public class BufferCache implements IBufferCacheInternal, ILifeCycleComponent {
tryRead(cPage);
cPage.valid = true;
} catch (Exception e) {
- LOGGER.log(Level.WARN, "Failure while trying to read a page from disk", e);
+ LOGGER.log(ExceptionUtils.causedByInterrupt(e) ? Level.DEBUG : Level.WARN,
+ "Failure while trying to read a page from disk", e);
throw e;
} finally {
if (!cPage.valid) {