9aman commented on code in PR #15142:
URL: https://github.com/apache/pinot/pull/15142#discussion_r1973214797


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java:
##########
@@ -136,6 +161,49 @@ private void manageRetentionForOfflineTable(String 
offlineTableName, RetentionSt
     }
   }
 
+  private List<String> getSegmentsToDeleteFromDeepstore(String 
offlineTableName, RetentionStrategy retentionStrategy,
+      List<String> segmentsToExclude)
+      throws IOException {
+
+    List<String> segmentsToDelete = new ArrayList<>();
+    String rawTableName = 
TableNameBuilder.extractRawTableName(offlineTableName);
+    URI tableDataUri = 
URIUtils.getUri(_pinotHelixResourceManager.getDataDir(), rawTableName);
+    PinotFS pinotFS = PinotFSFactory.create(tableDataUri.getScheme());
+
+    List<FileMetadata> deepstoreFiles = 
pinotFS.listFilesWithMetadata(tableDataUri, false);
+
+    for (FileMetadata fileMetadata : deepstoreFiles) {
+      if (fileMetadata.isDirectory()) {
+        continue;
+      }
+
+      String segmentName = extractSegmentName(fileMetadata.getFilePath());
+      if (segmentName == null || segmentsToExclude.contains(segmentName)) {

Review Comment:
   Rely on endTime in ZK Metadata for retention in case the segment ZK metadata 
is present. 
   This function relies on file modification time to decide whether a segment 
should be purged or not.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to