EmmyMiao87 commented on a change in pull request #1154: Add logic of cancel job URL: https://github.com/apache/incubator-doris/pull/1154#discussion_r283656604
########## 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 do not get it twice. The containsKey does not get the value, it just hash the key. Also, I add the read lock whether get and check null or containsKey ---------------------------------------------------------------- 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