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

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

commit 6c83967ebecc0fe0bb07cdeb09c4f42e2321dbe1
Author: Wenjun Ruan <[email protected]>
AuthorDate: Thu Jun 30 15:58:49 2022 +0800

    [Improvement-10617] Add comment in slot check (#10618)
    
    (cherry picked from commit 247ca4ae8a6d6e7a0580a999e04692a69f885144)
---
 .../server/master/runner/MasterSchedulerService.java                 | 5 +++--
 .../apache/dolphinscheduler/service/process/ProcessServiceImpl.java  | 4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
 
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
index 6de3541dae..1d0071a4dd 100644
--- 
a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
+++ 
b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java
@@ -202,8 +202,9 @@ public class MasterSchedulerService extends 
BaseDaemonThread {
         for (final Command command : commands) {
             masterPrepareExecService.execute(() -> {
                 try {
-                    // todo: this check is not safe, the slot may change after 
command transform.
-                    // slot check again
+                    // Note: this check is not safe, the slot may change after 
command transform.
+                    // We use the database transaction in `handleCommand` so 
that we can guarantee the command will always be executed
+                    // by only one master
                     SlotCheckState slotCheckState = slotCheck(command);
                     if (slotCheckState.equals(SlotCheckState.CHANGE) || 
slotCheckState.equals(SlotCheckState.INJECT)) {
                         logger.info("Master handle command {} skip, slot check 
state: {}", command.getId(), slotCheckState);
diff --git 
a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
 
b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
index 965ab89801..c527276933 100644
--- 
a/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
+++ 
b/dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java
@@ -137,6 +137,7 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.math.NumberUtils;
 
+import java.sql.SQLIntegrityConstraintViolationException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
@@ -350,7 +351,8 @@ public class ProcessServiceImpl implements ProcessService {
     }
 
     /**
-     * save error command, and delete original command
+     * Save error command, and delete original command. If the given command 
has already been moved into error command,
+     * will throw {@link SQLIntegrityConstraintViolationException ).
      *
      * @param command command
      * @param message message

Reply via email to