You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by lc...@apache.org on 2022/04/07 15:41:55 UTC
[beam] branch master updated: [BEAM-14175] Log read loop abort at debug rather than error (#17183)
This is an automated email from the ASF dual-hosted git repository.
lcwik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new af006afe9c0 [BEAM-14175] Log read loop abort at debug rather than error (#17183)
af006afe9c0 is described below
commit af006afe9c069bdcdde1dc2869d31e5ebacfe767
Author: Steven Niemitz <st...@gmail.com>
AuthorDate: Thu Apr 7 11:41:46 2022 -0400
[BEAM-14175] Log read loop abort at debug rather than error (#17183)
---
.../beam/runners/dataflow/worker/WorkItemStatusClient.java | 14 +++++++++++++-
.../dataflow/worker/util/common/worker/ReadOperation.java | 10 ++++++++--
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WorkItemStatusClient.java b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WorkItemStatusClient.java
index 4c37dbc548d..ff38385377e 100644
--- a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WorkItemStatusClient.java
+++ b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/WorkItemStatusClient.java
@@ -47,6 +47,7 @@ import org.apache.beam.runners.dataflow.worker.logging.DataflowWorkerLoggingHand
import org.apache.beam.runners.dataflow.worker.util.common.worker.NativeReader;
import org.apache.beam.runners.dataflow.worker.util.common.worker.NativeReader.DynamicSplitResult;
import org.apache.beam.runners.dataflow.worker.util.common.worker.NativeReader.Progress;
+import org.apache.beam.runners.dataflow.worker.util.common.worker.ReadOperation;
import org.apache.beam.sdk.util.UserCodeException;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.annotations.VisibleForTesting;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
@@ -65,7 +66,6 @@ import org.slf4j.LoggerFactory;
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
public class WorkItemStatusClient {
-
private static final Logger LOG = LoggerFactory.getLogger(WorkItemStatusClient.class);
private final WorkItem workItem;
@@ -132,6 +132,8 @@ public class WorkItemStatusClient {
+ "instances in PipelineOptions.\n";
LOG.error("{}: {}", logPrefix, message);
error.setMessage(message + DataflowWorkerLoggingHandler.formatException(t));
+ } else if (isReadLoopAbortedError(t)) {
+ LOG.debug("Read loop aborted error occurred during work unit execution", t);
} else {
LOG.error(
"{}: Uncaught exception occurred during work unit execution. This will be retried.",
@@ -191,6 +193,16 @@ public class WorkItemStatusClient {
return false;
}
+ private static boolean isReadLoopAbortedError(Throwable t) {
+ while (t != null) {
+ if (t instanceof ReadOperation.ReadLoopAbortedException) {
+ return true;
+ }
+ t = t.getCause();
+ }
+ return false;
+ }
+
private synchronized @Nullable WorkItemServiceState execute(WorkItemStatus status)
throws IOException {
WorkItemServiceState result = workUnitClient.reportWorkItemStatus(status);
diff --git a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ReadOperation.java b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ReadOperation.java
index 2f387db27ec..4867d6def42 100644
--- a/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ReadOperation.java
+++ b/runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/util/common/worker/ReadOperation.java
@@ -47,6 +47,12 @@ import org.slf4j.LoggerFactory;
"nullness" // TODO(https://issues.apache.org/jira/browse/BEAM-10402)
})
public class ReadOperation extends Operation {
+ public static class ReadLoopAbortedException extends InterruptedException {
+ public ReadLoopAbortedException() {
+ super("Read loop was aborted.");
+ }
+ }
+
private static final Logger LOG = LoggerFactory.getLogger(ReadOperation.class);
// This is the rate at which the local, threadsafe progress variable is updated from the iterator,
@@ -178,7 +184,7 @@ public class ReadOperation extends Operation {
}
if (abortRead.get()) {
- throw new InterruptedException("Read loop was aborted.");
+ throw new ReadLoopAbortedException();
}
// Call reader.iterator() outside the lock, because it can take an
@@ -204,7 +210,7 @@ public class ReadOperation extends Operation {
readerIterator.setProgressFromIterator();
for (boolean more = readerIterator.start(); more; more = readerIterator.advance()) {
if (abortRead.get()) {
- throw new InterruptedException("Read loop was aborted.");
+ throw new ReadLoopAbortedException();
}
if (progressUpdatePeriodMs == UPDATE_ON_EACH_ITERATION) {
readerIterator.setProgressFromIterator();