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

 ##########
 File path: fe/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
 ##########
 @@ -113,10 +114,11 @@ public void cancelLoadJob(CancelLoadStmt stmt) throws 
DdlException {
             if (!dbIdToLabelToLoadJobs.containsKey(db.getId())) {
                 throw new DdlException("Load job does not exist");
             }
-            if 
(!dbIdToLabelToLoadJobs.get(db.getId()).containsKey(stmt.getLabel())) {
+            Map<String, List<LoadJob>> labelToLoadJobs = 
dbIdToLabelToLoadJobs.get(db.getId());
+            if (!labelToLoadJobs.containsKey(stmt.getLabel())) {
                 throw new DdlException("Load job does not exist");
             }
-            List<LoadJob> loadJobList = 
dbIdToLabelToLoadJobs.get(db.getId()).get(stmt.getLabel());
+            List<LoadJob> loadJobList = labelToLoadJobs.get(stmt.getLabel());
 
 Review comment:
   I don't agree with you, you get it twice. And in some cases, If another 
thread modify this map, your check can't make sure you can get a not null value

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