Class StrategicSegmentAssigner

  • All Implemented Interfaces:
    SegmentActionHandler

    @NotThreadSafe
    public class StrategicSegmentAssigner
    extends Object
    implements SegmentActionHandler
    Used by the coordinator in each run for segment loading, dropping, balancing and broadcasting.

    An instance of this class is freshly created for each coordinator run.

    • Method Detail

      • getSegmentsToDelete

        public Map<String,​Set<org.apache.druid.timeline.SegmentId>> getSegmentsToDelete()
      • getDatasourceToInvalidLoadTiers

        public Map<String,​Set<String>> getDatasourceToInvalidLoadTiers()
      • moveSegment

        public boolean moveSegment​(org.apache.druid.timeline.DataSegment segment,
                                   ServerHolder sourceServer,
                                   List<ServerHolder> destinationServers)
        Moves the given segment from the source server to an eligible destination server.

        An eligible destination server must:

        • be present in the given list of destination servers
        • belong to the same tier as the source server
        • not already be serving or loading a replica of the segment
        • have enough space to load the segment

        The segment is not moved if:

        • there is no eligible destination server
        • or segment is already optimally placed
        • or some other error occurs
      • replicateSegment

        public void replicateSegment​(org.apache.druid.timeline.DataSegment segment,
                                     Map<String,​Integer> tierToReplicaCount)
        Description copied from interface: SegmentActionHandler
        Queues load or drop of replicas of the given segment to achieve the target replication level on all historical tiers.
        Specified by:
        replicateSegment in interface SegmentActionHandler
      • broadcastSegment

        public void broadcastSegment​(org.apache.druid.timeline.DataSegment segment)
        Description copied from interface: SegmentActionHandler
        Broadcasts the given segment to all servers that are broadcast targets.
        Specified by:
        broadcastSegment in interface SegmentActionHandler
      • deleteSegment

        public void deleteSegment​(org.apache.druid.timeline.DataSegment segment)
        Description copied from interface: SegmentActionHandler
        Marks the given segment as unused. Unused segments are eventually unloaded from all servers and deleted from metadata as well as deep storage.
        Specified by:
        deleteSegment in interface SegmentActionHandler