Skip to content

Commit

Permalink
Improve Retention Manager Segment Lineage Clean Up (apache#13232)
Browse files Browse the repository at this point in the history
  • Loading branch information
aishikbh authored Jun 9, 2024
1 parent 1229add commit 5da68d7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -999,13 +999,16 @@ public synchronized PinotResourceManagerResponse deleteSegments(String tableName
LOGGER.info("Trying to delete segments: {} from table: {} ", segmentNames, tableNameWithType);
Preconditions.checkArgument(TableNameBuilder.isTableResource(tableNameWithType),
"Table name: %s is not a valid table name with type suffix", tableNameWithType);
HelixHelper.removeSegmentsFromIdealState(_helixZkManager, tableNameWithType, segmentNames);
if (retentionPeriod != null) {
_segmentDeletionManager.deleteSegments(tableNameWithType, segmentNames,
TimeUtils.convertPeriodToMillis(retentionPeriod));
} else {
TableConfig tableConfig = ZKMetadataProvider.getTableConfig(_propertyStore, tableNameWithType);
_segmentDeletionManager.deleteSegments(tableNameWithType, segmentNames, tableConfig);

synchronized (getTableUpdaterLock(tableNameWithType)) {
HelixHelper.removeSegmentsFromIdealState(_helixZkManager, tableNameWithType, segmentNames);
if (retentionPeriod != null) {
_segmentDeletionManager.deleteSegments(tableNameWithType, segmentNames,
TimeUtils.convertPeriodToMillis(retentionPeriod));
} else {
TableConfig tableConfig = ZKMetadataProvider.getTableConfig(_propertyStore, tableNameWithType);
_segmentDeletionManager.deleteSegments(tableNameWithType, segmentNames, tableConfig);
}
}
return PinotResourceManagerResponse.success("Segment " + segmentNames + " deleted");
} catch (final Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
*/
public class RetentionManager extends ControllerPeriodicTask<Void> {
public static final long OLD_LLC_SEGMENTS_RETENTION_IN_MILLIS = TimeUnit.DAYS.toMillis(5L);
private static final RetryPolicy DEFAULT_RETRY_POLICY = RetryPolicies.exponentialBackoffRetryPolicy(5, 1000L, 2.0f);
private static final RetryPolicy DEFAULT_RETRY_POLICY = RetryPolicies.randomDelayRetryPolicy(20, 100L, 200L);

private static final Logger LOGGER = LoggerFactory.getLogger(RetentionManager.class);

Expand Down

0 comments on commit 5da68d7

Please sign in to comment.