Class SegmentHolder

java.lang.Object
org.apache.druid.server.coordinator.loading.SegmentHolder
All Implemented Interfaces:
Comparable<SegmentHolder>

public class SegmentHolder extends Object implements Comparable<SegmentHolder>
Represents a segment queued for a load or drop operation in a LoadQueuePeon.

Requests are naturally ordered using the COMPARE_ACTION_THEN_INTERVAL.

  • Field Details

    • NEWEST_SEGMENT_FIRST

      public static final com.google.common.collect.Ordering<DataSegment> NEWEST_SEGMENT_FIRST
      Orders newest segments first (i.e. segments with most recent intervals).

      The order is needed to ensure that:

      • Round-robin assignment distributes segments belonging to same or adjacent intervals uniformly across all servers.
      • Load queue prioritizes load of most recent segments, as they are presumed to contain more important data which is queried more often.
      • Replication throttler has a smaller impact on replicas of newer segments.
  • Constructor Details

  • Method Details

    • getSegment

      public DataSegment getSegment()
    • getAction

      public SegmentAction getAction()
    • isLoad

      public boolean isLoad()
    • getChangeRequest

      public DataSegmentChangeRequest getChangeRequest()
    • getSegmentIdentifier

      public String getSegmentIdentifier()
    • addCallback

      public void addCallback(@Nullable LoadPeonCallback callback)
    • getCallbacks

      public List<LoadPeonCallback> getCallbacks()
      Returns an immutable copy of all non-null callbacks for this queued segment.
    • markRequestSentToServer

      public void markRequestSentToServer()
    • hasRequestTimedOut

      public boolean hasRequestTimedOut()
      A request is considered to have timed out if the time elapsed since it was first sent to the server is greater than the configured load timeout.
      See Also:
    • incrementAndGetRunsInQueue

      public int incrementAndGetRunsInQueue()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(SegmentHolder that)
      Specified by:
      compareTo in interface Comparable<SegmentHolder>
    • toString

      public String toString()
      Overrides:
      toString in class Object