EmmyMiao87 commented on a change in pull request #1154: Add logic of cancel job
URL: https://github.com/apache/incubator-doris/pull/1154#discussion_r283639292
 
 

 ##########
 File path: fe/src/main/java/org/apache/doris/load/loadv2/LoadJob.java
 ##########
 @@ -303,18 +317,54 @@ public void cancelJobWithoutCheck(FailMsg failMsg) {
     public void cancelJob(FailMsg failMsg) throws DdlException {
         writeLock();
         try {
+            // check
             if (isCommitting) {
                 LOG.warn(new LogBuilder(LogKey.LOAD_JOB, id)
                                  .add("error_msg", "The txn which belongs to 
job is committing. "
                                          + "The job could not be cancelled in 
this step").build());
                 throw new DdlException("Job could not be cancelled while txn 
is committing");
             }
+            if (isFinished()) {
+                LOG.warn(new LogBuilder(LogKey.LOAD_JOB, id)
+                                 .add("state", state)
+                                 .add("error_msg", "Job could not be cancelled 
when job is finished or cancelled")
+                                 .build());
+                throw new DdlException("Job could not be cancelled when job is 
finished or cancelled");
+            }
+
+            checkAuth();
             executeCancel(failMsg);
         } finally {
             writeUnlock();
         }
     }
 
+    public void checkAuth() throws DdlException {
 
 Review comment:
   Whether it is a CANCEL command, the tableNames is the required param of 
`checkAuth`. So maybe getting it inside of function is better?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@doris.apache.org
For additional commands, e-mail: dev-h...@doris.apache.org

Reply via email to