Github user KanakaKumar commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1702#discussion_r158480479
  
    --- Diff: 
processing/src/main/java/org/apache/carbondata/processing/util/DeleteLoadFolders.java
 ---
    @@ -133,16 +138,23 @@ public static boolean deleteLoadFoldersFromFileSystem(
           for (LoadMetadataDetails oneLoad : details) {
             if (checkIfLoadCanBeDeleted(oneLoad, isForceDelete)) {
               String path = getSegmentPath(absoluteTableIdentifier, 0, 
oneLoad);
    -          boolean deletionStatus = 
physicalFactAndMeasureMetadataDeletion(path);
    -          if (deletionStatus) {
    -            isDeleted = true;
    -            oneLoad.setVisibility("false");
    -            LOGGER.info("Info: Deleted the load " + oneLoad.getLoadName());
    +          ICarbonLock segmentLock = 
CarbonLockFactory.getCarbonLockObj(absoluteTableIdentifier,
    +              CarbonTablePath.addSegmentPrefix(oneLoad.getLoadName()) + 
LockUsage.LOCK);
    +          if (segmentLock.lockWithRetries()) {
    +            boolean deletionStatus = 
physicalFactAndMeasureMetadataDeletion(path);
    +            if (deletionStatus) {
    +              isDeleted = true;
    +              oneLoad.setVisibility("false");
    +              LOGGER.info("Info: Deleted the load " + 
oneLoad.getLoadName());
    +            }
    +            segmentLock.unlock();
    --- End diff --
    
    Please move lock to finally 


---

Reply via email to