Improve the log message for lineage cleanup
Improve the code to add the log only if the segments are deleted
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
-import org.apache.commons.lang.StringUtils;
import org.apache.helix.ZNRecord;
import org.apache.helix.model.IdealState;
import org.apache.pinot.common.lineage.LineageEntry;
@@ -258,10 +257,11 @@ public class RetentionManager extends ControllerPeriodicTask<Void> {
if (SegmentLineageAccessHelper
.writeSegmentLineage(_pinotHelixResourceManager.getPropertyStore(), segmentLineage, expectedVersion)) {
// Delete segments based on the segment lineage
+ if (!segmentsToDelete.isEmpty()) {
_pinotHelixResourceManager.deleteSegments(tableNameWithType, segmentsToDelete);
- LOGGER.info("Finished cleaning up segment lineage for table: {}, deleted segments: {} in {}ms",
- tableNameWithType, StringUtils.join(segmentsToDelete, ","),
- (System.currentTimeMillis() - cleanupStartTime));
+ LOGGER.info("Finished cleaning up segment lineage for table: {} in {}ms, deleted segments: {}",
+ tableNameWithType, (System.currentTimeMillis() - cleanupStartTime), segmentsToDelete);
+ }
return true;
} else {
LOGGER.warn("Failed to write segment lineage back when cleaning up segment lineage for table: {}",
