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

    https://github.com/apache/carbondata/pull/1227#discussion_r131294374
  
    --- Diff: 
integration/spark-common/src/main/java/org/apache/carbondata/spark/load/CarbonLoaderUtil.java
 ---
    @@ -312,18 +313,28 @@ public static boolean 
recordLoadMetadata(LoadMetadataDetails newMetaEntry,
               }
               if (insertOverwrite) {
                 for (LoadMetadataDetails entry : listOfLoadFolderDetails) {
    -              entry.setLoadStatus(CarbonCommonConstants.MARKED_FOR_DELETE);
    +              if 
(!entry.getLoadStatus().equals(LoadStatusType.INSERT_OVERWRITE.getMessage())) {
    +                
entry.setLoadStatus(CarbonCommonConstants.MARKED_FOR_DELETE);
    +                // For insert overwrite, we will delete the old segment 
folder immediately
    +                // So collect the old segments here
    +                String path = 
carbonTablePath.getCarbonDataDirectoryPath("0", entry.getLoadName());
    +                staleFolders.add(FileFactory.getCarbonFile(path));
    +              }
                 }
               }
               listOfLoadFolderDetails.set(indexToOverwriteNewMetaEntry, 
newMetaEntry);
             }
             SegmentStatusManager.writeLoadDetailsIntoFile(tableStatusPath, 
listOfLoadFolderDetails
                 .toArray(new 
LoadMetadataDetails[listOfLoadFolderDetails.size()]));
    +        // Delete all old stale segment folders
    +        for (CarbonFile staleFolder : staleFolders) {
    +          CarbonUtil.deleteFoldersAndFiles(staleFolder);
    +        }
    --- End diff --
    
    but it seems that we delete the folder without checking the operation 
status here,different from the behavior in another changes. Am I missing 
something?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to