You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ju...@apache.org on 2025/02/21 02:53:00 UTC

(flink) branch master updated: [FLINK-35622][runtime] Filter out noisy 'Coordinator of operator xxxx does not exist' exceptions in CollectResultFetcher

This is an automated email from the ASF dual-hosted git repository.

junrui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new c92f208f4a0 [FLINK-35622][runtime] Filter out noisy 'Coordinator of operator xxxx does not exist' exceptions in CollectResultFetcher
c92f208f4a0 is described below

commit c92f208f4a074812b5314f2b4858f244b5ecd9fe
Author: gengbiao.gb <ge...@alibaba-inc.com>
AuthorDate: Tue Feb 18 19:58:23 2025 +0800

    [FLINK-35622][runtime] Filter out noisy 'Coordinator of operator xxxx does not exist' exceptions in CollectResultFetcher
---
 .../scheduler/CoordinatorNotExistException.java    | 43 ++++++++++++++++++++++
 .../DefaultOperatorCoordinatorHandler.java         |  6 +--
 .../scheduler/adaptive/AdaptiveScheduler.java      |  6 +--
 .../operators/collect/CollectResultFetcher.java    |  5 +++
 4 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/CoordinatorNotExistException.java b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/CoordinatorNotExistException.java
new file mode 100644
index 00000000000..58a6c2a23de
--- /dev/null
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/CoordinatorNotExistException.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.runtime.scheduler;
+
+import org.apache.flink.runtime.jobgraph.OperatorID;
+import org.apache.flink.runtime.rest.handler.RestHandlerException;
+
+import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus;
+
+/** Indicates coordinator of the operator does not exist. */
+public class CoordinatorNotExistException extends RestHandlerException {
+    private static final long serialVersionUID = 1L;
+
+    public CoordinatorNotExistException(
+            OperatorID operator, String otherPossibleCause, boolean logException) {
+        super(
+                "Coordinator of operator "
+                        + operator
+                        + " does not exist"
+                        + (otherPossibleCause == null ? "." : " or " + otherPossibleCause),
+                HttpResponseStatus.NOT_FOUND,
+                logException ? LoggingBehavior.LOG : LoggingBehavior.IGNORE);
+    }
+
+    public CoordinatorNotExistException(OperatorID operator) {
+        this(operator, null, true);
+    }
+}
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/DefaultOperatorCoordinatorHandler.java b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/DefaultOperatorCoordinatorHandler.java
index 7896e97fbfa..509118244c3 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/DefaultOperatorCoordinatorHandler.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/DefaultOperatorCoordinatorHandler.java
@@ -135,10 +135,8 @@ public class DefaultOperatorCoordinatorHandler implements OperatorCoordinatorHan
 
         final OperatorCoordinatorHolder coordinatorHolder = coordinatorMap.get(operator);
         if (coordinatorHolder == null) {
-            throw new FlinkException(
-                    "Coordinator of operator "
-                            + operator
-                            + " does not exist or the job vertex this operator belongs to is not initialized.");
+            throw new CoordinatorNotExistException(
+                    operator, "the job vertex this operator belongs to is not initialized.", false);
         }
 
         final OperatorCoordinator coordinator = coordinatorHolder.coordinator();
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java
index 7f759b1c3c6..7bb705628bf 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/scheduler/adaptive/AdaptiveScheduler.java
@@ -95,6 +95,7 @@ import org.apache.flink.runtime.operators.coordination.TaskNotRunningException;
 import org.apache.flink.runtime.query.KvStateLocation;
 import org.apache.flink.runtime.query.UnknownKvStateLocation;
 import org.apache.flink.runtime.rpc.FatalErrorHandler;
+import org.apache.flink.runtime.scheduler.CoordinatorNotExistException;
 import org.apache.flink.runtime.scheduler.DefaultVertexParallelismInfo;
 import org.apache.flink.runtime.scheduler.DefaultVertexParallelismStore;
 import org.apache.flink.runtime.scheduler.ExecutionGraphFactory;
@@ -1055,10 +1056,7 @@ public class AdaptiveScheduler
                 .orElseGet(
                         () ->
                                 FutureUtils.completedExceptionally(
-                                        new FlinkException(
-                                                "Coordinator of operator "
-                                                        + operator
-                                                        + " does not exist")));
+                                        new CoordinatorNotExistException(operator)));
     }
 
     @Override
diff --git a/flink-runtime/src/main/java/org/apache/flink/streaming/api/operators/collect/CollectResultFetcher.java b/flink-runtime/src/main/java/org/apache/flink/streaming/api/operators/collect/CollectResultFetcher.java
index c745da48750..161586ffdc1 100644
--- a/flink-runtime/src/main/java/org/apache/flink/streaming/api/operators/collect/CollectResultFetcher.java
+++ b/flink-runtime/src/main/java/org/apache/flink/streaming/api/operators/collect/CollectResultFetcher.java
@@ -27,6 +27,7 @@ import org.apache.flink.core.execution.JobClient;
 import org.apache.flink.runtime.dispatcher.UnavailableDispatcherOperationException;
 import org.apache.flink.runtime.messages.FlinkJobNotFoundException;
 import org.apache.flink.runtime.operators.coordination.CoordinationRequestGateway;
+import org.apache.flink.runtime.scheduler.CoordinatorNotExistException;
 import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.Preconditions;
 
@@ -139,6 +140,10 @@ public class CollectResultFetcher<T> {
                         LOG.debug(
                                 "The job cannot be found. It is very likely that the job is not in a RUNNING state.",
                                 e);
+                    } else if (ExceptionUtils.findThrowableWithMessage(
+                                    e, CoordinatorNotExistException.class.getName())
+                            .isPresent()) {
+                        LOG.debug("The coordinator does not exist.", e);
                     } else {
                         LOG.warn("An exception occurred when fetching query results", e);
                     }