9aman commented on code in PR #15155:
URL: https://github.com/apache/pinot/pull/15155#discussion_r1975926133
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/SegmentDeletionManager.java:
##########
@@ -349,23 +350,36 @@ public void
removeAgedDeletedSegments(LeadControllerManager leadControllerManage
return;
}
+ // Clean the array of tableNameDirs by removing trailing slashes
+ // This is crucial to fetch the right tableName from the uri
+ for (int i = 0; i < tableNameDirs.length; i++) {
+ if (tableNameDirs[i].endsWith(DELIMITER)) {
+ tableNameDirs[i] = tableNameDirs[i].substring(0,
tableNameDirs[i].length() - 1);
+ }
+ }
+
for (String tableNameDir : tableNameDirs) {
String tableName = URIUtils.getLastPart(tableNameDir);
if (leadControllerManager.isLeaderForTable(tableName)) {
URI tableNameURI = URIUtils.getUri(deletedDirURI.toString(),
URIUtils.encode(tableName));
// Get files that are aged
final String[] targetFiles = pinotFS.listFiles(tableNameURI,
false);
int numFilesDeleted = 0;
+ URI targetURI = null;
for (String targetFile : targetFiles) {
- URI targetURI =
- URIUtils.getUri(tableNameURI.toString(),
URIUtils.encode(URIUtils.getLastPart(targetFile)));
- long deletionTimeMs =
getDeletionTimeMsFromFile(targetURI.toString(),
pinotFS.lastModified(targetURI));
- if (System.currentTimeMillis() >= deletionTimeMs) {
- if (!pinotFS.delete(targetURI, true)) {
- LOGGER.warn("Cannot remove file {} from deleted directory.",
targetURI);
- } else {
- numFilesDeleted++;
+ try {
+ targetURI =
Review Comment:
Have added the UT's by replicating what GcsPinotFs returns
--
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]