Class StrategicSegmentAssigner

java.lang.Object
org.apache.druid.server.coordinator.loading.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.

  • Constructor Details

  • Method Details

    • getReplicationStatus

      public SegmentReplicationStatus getReplicationStatus()
    • getSegmentsToDelete

      public Map<String,Set<SegmentId>> getSegmentsToDelete()
    • getSegmentsWithZeroRequiredReplicas

      public Map<String,Set<DataSegment>> getSegmentsWithZeroRequiredReplicas()
    • getDatasourceToInvalidLoadTiers

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

      public boolean moveSegment(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(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(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(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
    • getBroadcastSegments

      public Set<DataSegment> getBroadcastSegments()