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

 ##########
 File path: fe/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
 ##########
 @@ -101,6 +101,34 @@ private void addLoadJob(LoadJob loadJob) {
         loadJobScheduler.submitJob(loadJob);
     }
 
+    public void cancelLoadJob(CancelLoadStmt stmt) throws DdlException {
+        Database db = Catalog.getInstance().getDb(stmt.getDbName());
+        if (db == null) {
+            throw new DdlException("Db does not exist. name: " + 
stmt.getDbName());
+        }
+
+        LoadJob loadJob = null;
+        readLock();
+        try {
+            if (!dbIdToLabelToLoadJobs.containsKey(db.getId())) {
+                throw new DdlException("Load job does not exist");
+            }
+            if 
(!dbIdToLabelToLoadJobs.get(db.getId()).containsKey(stmt.getLabel())) {
+                throw new DdlException("Load job does not exist");
+            }
+            List<LoadJob> loadJobList = 
dbIdToLabelToLoadJobs.get(db.getId()).get(stmt.getLabel());
 
 Review comment:
   you execute `containKey` or `get` multiple times. please use a local 
variable to avoid that 

----------------------------------------------------------------
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