Class KillUnusedSegments

java.lang.Object
org.apache.druid.server.coordinator.duty.KillUnusedSegments
All Implemented Interfaces:
CoordinatorDuty

public class KillUnusedSegments extends Object implements CoordinatorDuty

Completely removes information about unused segments who have an interval end that comes before now - durationToRetain from the metadata store. durationToRetain can be a positive or negative duration, negative meaning the interval end target will be in the future. Also, durationToRetain can be ignored if ignoreDurationToRetain is enabled, meaning that there is no upper bound to the end interval of segments that will be killed. The umbrella interval of the unused segments per datasource to be killed is determined by findIntervalForKill(String, DateTime, CoordinatorRunStats), which takes into account the configured bufferPeriod. However, the kill task needs to check again for max bufferPeriod for the unused segments in the widened interval as there can be multiple unused segments with different used_status_last_updated time.

The datasources to be killed during each cycle are selected from datasourceCircularKillList. This state is refreshed in a run if the set of datasources to be killed changes. Consecutive duplicate datasources are avoided across runs, provided there are other datasources to be killed.

See Also:
  • for details of the actual kill task and UnusedSegmentKiller to run embedded kill tasks on the Overlord.