hanishakoneru commented on a change in pull request #1493: URL: https://github.com/apache/hadoop-ozone/pull/1493#discussion_r504812062
########## File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java ########## @@ -397,33 +399,29 @@ public void updateDeleteTransactionId(Map<Long, Long> deleteTransactionMap) if (deleteTransactionMap == null) { return; } - org.apache.hadoop.hdds.utils.db.BatchOperation batchOperation = - batchHandler.initBatchOperation(); - lock.lock(); - try { - for (Map.Entry<Long, Long> entry : deleteTransactionMap.entrySet()) { + try(org.apache.hadoop.hdds.utils.db.BatchOperation batchOperation = + batchHandler.initBatchOperation()) { + lock.lock(); Review comment: Shouldn't lock() be called outside the try block? If there is a chance that the initBatchOperation() can fail, then lock.unlock() would throw IllegalMonitorStateException as the lock is not held by it. ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org