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

wenjun pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 5614699888 [Fix-17050][Master] Fix workflow graph topology logical 
error (#17051)
5614699888 is described below

commit 56146998880ea4d4fda9a266a078c5b14a2dbaa4
Author: ShenShiQi <[email protected]>
AuthorDate: Fri Mar 14 11:28:16 2025 +0800

    [Fix-17050][Master] Fix workflow graph topology logical error (#17051)
---
 .../graph/WorkflowGraphTopologyLogicalVisitor.java   | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git 
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowGraphTopologyLogicalVisitor.java
 
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowGraphTopologyLogicalVisitor.java
index 24efa3baf3..7734e7e0df 100644
--- 
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowGraphTopologyLogicalVisitor.java
+++ 
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/graph/WorkflowGraphTopologyLogicalVisitor.java
@@ -131,20 +131,26 @@ public class WorkflowGraphTopologyLogicalVisitor {
                 .filter(entry -> entry.getValue() == 0)
                 .map(Map.Entry::getKey)
                 .collect(Collectors.toCollection(LinkedList::new));
+        // Visited table, used to record the visited nodes
+        Set<String> visitedTaskCodes = new HashSet<>();
 
         while (!bootstrapTaskCodes.isEmpty()) {
             String taskName = bootstrapTaskCodes.removeFirst();
             if (inDegreeMap.get(taskName) > 0) {
                 continue;
             }
-            final Set<String> successors = 
workflowGraph.getSuccessors(taskName);
-            if (subGraphNodes.contains(taskName)) {
-                visitFunction.accept(taskName, successors);
+            // Visit only when the in-degree is 0
+            if (!visitedTaskCodes.contains(taskName)) {
+                visitedTaskCodes.add(taskName); // Record the nodes
+                final Set<String> successors = 
workflowGraph.getSuccessors(taskName);
+                if (subGraphNodes.contains(taskName)) {
+                    visitFunction.accept(taskName, successors);
+                }
+                for (String successor : successors) {
+                    inDegreeMap.put(successor, inDegreeMap.get(successor) - 1);
+                }
+                bootstrapTaskCodes.addAll(successors);
             }
-            for (String successor : successors) {
-                inDegreeMap.put(successor, inDegreeMap.get(successor) - 1);
-            }
-            bootstrapTaskCodes.addAll(successors);
         }
     }
 

Reply via email to