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 Summary
Constructors Constructor Description StrategicSegmentAssigner(SegmentLoadQueueManager loadQueueManager, DruidCluster cluster, BalancerStrategy strategy, SegmentLoadingConfig loadingConfig, CoordinatorRunStats stats)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbroadcastSegment(org.apache.druid.timeline.DataSegment segment)Broadcasts the given segment to all servers that are broadcast targets.voiddeleteSegment(org.apache.druid.timeline.DataSegment segment)Marks the given segment as unused.Map<String,Set<String>>getDatasourceToInvalidLoadTiers()SegmentReplicationStatusgetReplicationStatus()Map<String,Set<org.apache.druid.timeline.SegmentId>>getSegmentsToDelete()CoordinatorRunStatsgetStats()booleanmoveSegment(org.apache.druid.timeline.DataSegment segment, ServerHolder sourceServer, List<ServerHolder> destinationServers)Moves the given segment from the source server to an eligible destination server.voidreplicateSegment(org.apache.druid.timeline.DataSegment segment, Map<String,Integer> tierToReplicaCount)Queues load or drop of replicas of the given segment to achieve the target replication level on all historical tiers.
-
-
-
Constructor Detail
-
StrategicSegmentAssigner
public StrategicSegmentAssigner(SegmentLoadQueueManager loadQueueManager, DruidCluster cluster, BalancerStrategy strategy, SegmentLoadingConfig loadingConfig, CoordinatorRunStats stats)
-
-
Method Detail
-
getStats
public CoordinatorRunStats getStats()
-
getReplicationStatus
public SegmentReplicationStatus getReplicationStatus()
-
getSegmentsToDelete
public Map<String,Set<org.apache.druid.timeline.SegmentId>> getSegmentsToDelete()
-
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:SegmentActionHandlerQueues load or drop of replicas of the given segment to achieve the target replication level on all historical tiers.- Specified by:
replicateSegmentin interfaceSegmentActionHandler
-
broadcastSegment
public void broadcastSegment(org.apache.druid.timeline.DataSegment segment)
Description copied from interface:SegmentActionHandlerBroadcasts the given segment to all servers that are broadcast targets.- Specified by:
broadcastSegmentin interfaceSegmentActionHandler
-
deleteSegment
public void deleteSegment(org.apache.druid.timeline.DataSegment segment)
Description copied from interface:SegmentActionHandlerMarks the given segment as unused. Unused segments are eventually unloaded from all servers and deleted from metadata as well as deep storage.- Specified by:
deleteSegmentin interfaceSegmentActionHandler
-
-