walterddr commented on a change in pull request #8077: URL: https://github.com/apache/pinot/pull/8077#discussion_r794088549
########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/SegmentDeletionManager.java ########## @@ -176,29 +178,43 @@ protected void removeSegmentFromStore(String tableNameWithType, String segmentId } if (_dataDir != null) { String rawTableName = TableNameBuilder.extractRawTableName(tableNameWithType); - URI fileToMoveURI = URIUtils.getUri(_dataDir, rawTableName, URIUtils.encode(segmentId)); - URI deletedSegmentDestURI = URIUtils.getUri(_dataDir, DELETED_SEGMENTS, rawTableName, URIUtils.encode(segmentId)); - PinotFS pinotFS = PinotFSFactory.create(fileToMoveURI.getScheme()); - - try { - if (pinotFS.exists(fileToMoveURI)) { - // Overwrites the file if it already exists in the target directory. - if (pinotFS.move(fileToMoveURI, deletedSegmentDestURI, true)) { - // Updates last modified. - // Touch is needed here so that removeAgedDeletedSegments() works correctly. - pinotFS.touch(deletedSegmentDestURI); - LOGGER.info("Moved segment {} from {} to {}", segmentId, fileToMoveURI.toString(), - deletedSegmentDestURI.toString()); + URI fileToDeleteURI = URIUtils.getUri(_dataDir, rawTableName, URIUtils.encode(segmentId)); + PinotFS pinotFS = PinotFSFactory.create(fileToDeleteURI.getScheme()); + if (_defaultDeletedSegmentsRetentionInDays == 0) { + // delete the segment file instantly if retention is set to zero + try { + if (pinotFS.delete(fileToDeleteURI, false)) { Review comment: ```suggestion if (pinotFS.delete(fileToDeleteURI, true)) { ``` -- 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: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org