Class ServerHolder
java.lang.Object
org.apache.druid.server.coordinator.ServerHolder
- All Implemented Interfaces:
Comparable<ServerHolder>
Encapsulates the state of a DruidServer during a single coordinator run.
ServerHolders are naturally ordered by available size, servers with more available size first.
-
Constructor Summary
ConstructorsConstructorDescriptionServerHolder(ImmutableDruidServer server, LoadQueuePeon peon) ServerHolder(ImmutableDruidServer server, LoadQueuePeon peon, boolean isDecommissioning) ServerHolder(ImmutableDruidServer server, LoadQueuePeon peon, boolean isDecommissioning, boolean isUnmanaged, int maxSegmentsInLoadQueue, int maxLifetimeInQueue) Creates a new ServerHolder valid for a single coordinator run.ServerHolder(ImmutableDruidServer server, LoadQueuePeon peon, boolean isDecommissioning, int maxSegmentsInLoadQueue, int maxLifetimeInQueue) -
Method Summary
Modifier and TypeMethodDescriptionbooleancancelOperation(SegmentAction action, DataSegment segment) booleancanLoadSegment(DataSegment segment) Checks if the server can load the given segment.intcompareTo(ServerHolder serverHolder) booleangetActionOnSegment(DataSegment segment) longSegments that are currently in the queue for being loaded on this server.longintintintgetPeon()doubleCounts for segments that are expected to be loaded on this server once all the operations in progress have completed.Segments that are expected to be loaded on this server once all the operations in progress have completed.Segments queued for load, drop or move on this server.Segments that are currently loaded on this server.longTotal projected disk usage of this server in bytes.inthashCode()booleanbooleanisDroppingSegment(DataSegment segment) booleanisLoadingSegment(DataSegment segment) booleanbooleanisProjectedSegment(DataSegment segment) booleanbooleanisServingSegment(DataSegment segment) Returns true if this server has the segment loaded and is not dropping it.booleanReturns true if this server is unmanaged and should not participate in segment assignment, drop or balancing.booleanstartOperation(SegmentAction action, DataSegment segment) toString()
-
Constructor Details
-
ServerHolder
-
ServerHolder
-
ServerHolder
public ServerHolder(ImmutableDruidServer server, LoadQueuePeon peon, boolean isDecommissioning, int maxSegmentsInLoadQueue, int maxLifetimeInQueue) -
ServerHolder
public ServerHolder(ImmutableDruidServer server, LoadQueuePeon peon, boolean isDecommissioning, boolean isUnmanaged, int maxSegmentsInLoadQueue, int maxLifetimeInQueue) Creates a new ServerHolder valid for a single coordinator run.- Parameters:
server- Underlying Druid serverpeon- Load queue peon for this serverisDecommissioning- Whether the server is decommissioningisUnmanaged- Whether this server is unmanaged and should not participate in segment assignment, drop or balancing.maxSegmentsInLoadQueue- Max number of segments that can be present in the load queue at any point. If this is 0, the load queue can have an unlimited number of segments.maxLifetimeInQueue- Number of coordinator runs after a which a segment in load/drop queue is considered to be stuck.
-
-
Method Details
-
getServer
-
getPeon
-
getMaxSize
public long getMaxSize() -
getSizeUsed
public long getSizeUsed()Total projected disk usage of this server in bytes.The total size:
- INCLUDES segments loaded on this server
- INCLUDES segments loading on this server (actions: LOAD/REPLICATE)
- INCLUDES segments moving to this server (action: MOVE_TO)
- INCLUDES segments moving from this server (action: MOVE_FROM). This is because these segments have only been marked for drop. We include the size of these segments to avoid over-assigning the server in case the corresponding MOVE_TO operation gets delayed or fails.
- EXCLUDES segments dropping from this server (action: DROP). Excluding these segments cannot result in over-assignment because drops are always processed before loads.
-
getPercentUsed
public double getPercentUsed() -
isDecommissioning
public boolean isDecommissioning() -
isUnmanaged
public boolean isUnmanaged()Returns true if this server is unmanaged and should not participate in segment assignment, drop or balancing. -
isLoadQueueFull
public boolean isLoadQueueFull() -
getAvailableSize
public long getAvailableSize() -
canLoadSegment
Checks if the server can load the given segment.A load is possible only if the server meets all of the following criteria:
- is not being decommissioned
- is not already serving the segment
- is not performing any other action on the segment
- has not already exceeded the load queue limit in this run
- has available disk space
-
getActionOnSegment
-
getQueuedSegments
Segments queued for load, drop or move on this server.- Contains segments present in the queue when the current coordinator run started.
- Contains segments added to the queue during the current run.
- Maps replicating segments to LOAD rather than REPLICATE for simplicity.
- Does not contain segments whose actions were cancelled.
-
getProjectedSegmentCounts
Counts for segments that are expected to be loaded on this server once all the operations in progress have completed. -
getProjectedSegments
Segments that are expected to be loaded on this server once all the operations in progress have completed. -
isProjectedSegment
-
getLoadingSegments
Segments that are currently in the queue for being loaded on this server. This does not include segments that are being moved to this server. -
getServedSegments
Segments that are currently loaded on this server. -
isServingSegment
Returns true if this server has the segment loaded and is not dropping it. -
isLoadingSegment
-
isDroppingSegment
-
getNumMovingSegments
public int getNumMovingSegments() -
getNumLoadingReplicas
public int getNumLoadingReplicas() -
getNumQueuedSegments
public int getNumQueuedSegments() -
startOperation
-
cancelOperation
-
isRealtimeServer
public boolean isRealtimeServer() -
compareTo
- Specified by:
compareToin interfaceComparable<ServerHolder>
-
equals
-
hashCode
public int hashCode() -
toString
-