mcvsubbu commented on a change in pull request #3578: Changing segmentCommitEnd 
to support deep storage
URL: https://github.com/apache/incubator-pinot/pull/3578#discussion_r238457128
 
 

 ##########
 File path: 
pinot-controller/src/main/java/com/linkedin/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java
 ##########
 @@ -364,27 +365,24 @@ public boolean commitSegmentFile(String tableName, 
CommittingSegmentDescriptor c
     }
 
     try {
-      
com.linkedin.pinot.common.utils.FileUtils.moveFileWithOverwrite(segmentFile, 
fileToMoveTo);
+      pinotFS.move(segmentFileURI, uriToMoveTo, true);
     } catch (Exception e) {
-      LOGGER.error("Could not move {} to {}", segmentFile, segmentName, e);
+      LOGGER.error("Could not move {} to {}", segmentLocation, segmentName, e);
       return false;
     }
-    for (File file : tableDir.listFiles()) {
-      if 
(file.getName().startsWith(SegmentCompletionUtils.getSegmentNamePrefix(segmentName)))
 {
-        LOGGER.warn("Deleting " + file);
-        FileUtils.deleteQuietly(file);
-      }
-    }
-    return true;
-  }
 
-  private static File convertURIToSegmentLocation(String segmentLocation) {
     try {
-      URI uri = new URI(segmentLocation);
-      return new File(uri.getPath());
-    } catch (URISyntaxException e) {
-      throw new RuntimeException("Could not convert URI " + segmentLocation + 
" to segment location", e);
+      for (String uri : pinotFS.listFiles(tableDirURI, true)) {
+        if 
(uri.contains(SegmentCompletionUtils.getSegmentNamePrefix(segmentName))) {
+          LOGGER.warn("Deleting " + uri);
+          pinotFS.delete(new URI(uri), true);
 
 Review comment:
   move the try catch one level inside so we can log which file we were 
attempting to delete

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to