jackjlli commented on a change in pull request #8077:
URL: https://github.com/apache/pinot/pull/8077#discussion_r794066155
##########
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:
By checking into the code, it seems the current only place to use
`forceDelete` being false is to delete a segment dir if it's empty in
`SegmentDeletionManager` class. So it'd be good to set it to true here since
it's to delete a segment instead of a segment dir?
--
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]