You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/10/29 14:14:31 UTC

[GitHub] [incubator-seatunnel] TaoZex commented on a diff in pull request #3213: [Bug][Engine Server] fix checkpoint stuck error

TaoZex commented on code in PR #3213:
URL: https://github.com/apache/incubator-seatunnel/pull/3213#discussion_r1008706024


##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/resourcemanager/AbstractResourceManager.java:
##########
@@ -170,9 +170,19 @@ public CompletableFuture<Void> releaseResource(long jobId, SlotProfile profile)
 
     @Override
     public boolean slotActiveCheck(SlotProfile profile) {
-        return registerWorker.values().stream()
-            .flatMap(workerProfile -> Arrays.stream(workerProfile.getAssignedSlots()))
-            .anyMatch(s -> s.getSlotID() == profile.getSlotID());
+        boolean active;
+        if (registerWorker.containsKey(profile.getWorker())) {
+            active = Arrays.stream(registerWorker.get(profile.getWorker()).getAssignedSlots())
+                .allMatch(s -> s.getSlotID() == profile.getSlotID());
+        } else {
+            active = false;

Review Comment:
   else is redundant



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/resourcemanager/AbstractResourceManager.java:
##########
@@ -170,9 +170,19 @@ public CompletableFuture<Void> releaseResource(long jobId, SlotProfile profile)
 
     @Override
     public boolean slotActiveCheck(SlotProfile profile) {
-        return registerWorker.values().stream()
-            .flatMap(workerProfile -> Arrays.stream(workerProfile.getAssignedSlots()))
-            .anyMatch(s -> s.getSlotID() == profile.getSlotID());
+        boolean active;
+        if (registerWorker.containsKey(profile.getWorker())) {
+            active = Arrays.stream(registerWorker.get(profile.getWorker()).getAssignedSlots())
+                .allMatch(s -> s.getSlotID() == profile.getSlotID());
+        } else {
+            active = false;
+        }
+        if (!active) {
+            LOGGER.info("received slot active check failed profile: " + profile);
+        } else {
+            LOGGER.fine("received slot active check success. profile: " + profile);

Review Comment:
   remove .



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org