kunal642 commented on a change in pull request #4109: URL: https://github.com/apache/carbondata/pull/4109#discussion_r596681621
########## File path: core/src/main/java/org/apache/carbondata/core/util/DeleteLoadFolders.java ########## @@ -118,14 +118,16 @@ private static void physicalFactAndMeasureMetadataDeletion(CarbonTable carbonTab if (canDeleteThisLoad(oneLoad, isForceDelete, cleanStaleInProgress)) { try { if (oneLoad.getSegmentFile() != null) { - String tablePath = carbonTable.getAbsoluteTableIdentifier().getTablePath(); - Segment segment = new Segment(oneLoad.getLoadName(), oneLoad.getSegmentFile()); - // No need to delete physical data for external segments. - if (oneLoad.getPath() == null || oneLoad.getPath().equalsIgnoreCase("NA")) { - SegmentFileStore.deleteSegment(tablePath, segment, specs, updateStatusManager); + if (canSegmentLockBeAcquired(oneLoad, carbonTable.getAbsoluteTableIdentifier())) { Review comment: move this method call in canDeleteThisLoad().. and refactor the other places as well ---------------------------------------------------------------- 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