Package org.apache.druid.rpc.indexing
Class OverlordClientImpl
java.lang.Object
org.apache.druid.rpc.indexing.OverlordClientImpl
- All Implemented Interfaces:
OverlordClient
Production implementation of
OverlordClient.-
Constructor Summary
ConstructorsConstructorDescriptionOverlordClientImpl(ServiceClient client, com.fasterxml.jackson.databind.ObjectMapper jsonMapper) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.common.util.concurrent.ListenableFuture<Void>cancelTask(String taskId) Cancel a task.com.google.common.util.concurrent.ListenableFuture<URI>Contact the Overlord that we believe to be the leader, and return the result of its/druid/indexer/v1/leaderAPI.findLockedIntervals(List<LockFilterPolicy> lockFilterPolicies) Returns a list of intervals locked by higher priority conflicting lock typescom.google.common.util.concurrent.ListenableFuture<ClusterCompactionConfig>Gets the current cluster-level compaction config.com.google.common.util.concurrent.ListenableFuture<IndexingTotalWorkerCapacityInfo>Returns total worker capacity details.com.google.common.util.concurrent.ListenableFuture<List<IndexingWorkerInfo>>Returns information about workers.com.google.common.util.concurrent.ListenableFuture<Boolean>Checks if compaction supervisors are enabled on the Overlord.com.google.common.util.concurrent.ListenableFuture<Integer>killPendingSegments(String dataSource, org.joda.time.Interval interval) Deletes pending segment records from the metadata store for a particular datasource.com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse>markNonOvershadowedSegmentsAsUsed(String dataSource) Marks all non-overshadowed segments of the datasource as used.com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse>markNonOvershadowedSegmentsAsUsed(String dataSource, SegmentsToUpdateFilter filter) Marks non-overshadowed segments that satisfy the given filter as used.com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse>markSegmentAsUnused(SegmentId segmentId) Marks the given segment as unused.com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse>markSegmentAsUsed(SegmentId segmentId) Marks the given segment as used.com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse>markSegmentsAsUnused(String dataSource) Marks all non-overshadowed segments of the datasource as unused.com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse>markSegmentsAsUnused(String dataSource, SegmentsToUpdateFilter filter) Marks non-overshadowed segments that satisfy the given filter as unused.postSupervisor(SupervisorSpec supervisor) Submits a supervisor spec to the Overlord.com.google.common.util.concurrent.ListenableFuture<Void>Run a task with the provided ID and payload.com.google.common.util.concurrent.ListenableFuture<CloseableIterator<SupervisorStatus>>Returns all current supervisor statuses.com.google.common.util.concurrent.ListenableFuture<TaskPayloadResponse>taskPayload(String taskId) Returns the payload for a task as an instance ofClientTaskQuery.com.google.common.util.concurrent.ListenableFuture<TaskReport.ReportMap>taskReportAsMap(String taskId) Returns the report object for a task as a map.com.google.common.util.concurrent.ListenableFuture<TaskStatusResponse>taskStatus(String taskId) ReturnsTaskStatusResponsefor a particular task ID.com.google.common.util.concurrent.ListenableFuture<CloseableIterator<TaskStatusPlus>>taskStatuses(String state, String dataSource, Integer maxCompletedTasks) ReturnTaskStatusPlusfor all tasks matching a set of optional search parameters.com.google.common.util.concurrent.ListenableFuture<Map<String,TaskStatus>> taskStatuses(Set<String> taskIds) ReturnTaskStatusfor a set of task IDs.terminateSupervisor(String supervisorId) Shuts down a supervisor.com.google.common.util.concurrent.ListenableFuture<UpdateResponse>Gets the current cluster-level compaction config.withRetryPolicy(ServiceRetryPolicy retryPolicy) Returns a copy of this client with a different retry policy.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.rpc.indexing.OverlordClient
runKillTask
-
Constructor Details
-
OverlordClientImpl
public OverlordClientImpl(ServiceClient client, com.fasterxml.jackson.databind.ObjectMapper jsonMapper)
-
-
Method Details
-
findCurrentLeader
Description copied from interface:OverlordClientContact the Overlord that we believe to be the leader, and return the result of its/druid/indexer/v1/leaderAPI. This may be a different Overlord server than the one we contacted, if a leader change happened since the last time we updated our sense of who the leader is.- Specified by:
findCurrentLeaderin interfaceOverlordClient
-
runTask
public com.google.common.util.concurrent.ListenableFuture<Void> runTask(String taskId, Object taskObject) Description copied from interface:OverlordClientRun a task with the provided ID and payload. The payload must be convertible by anObjectMapperinto a Task object. This method does not take Task objects directly, because Task is in the indexing-service package.- Specified by:
runTaskin interfaceOverlordClient- Parameters:
taskId- task IDtaskObject- task payload
-
cancelTask
Description copied from interface:OverlordClientCancel a task.- Specified by:
cancelTaskin interfaceOverlordClient- Parameters:
taskId- task ID
-
taskStatuses
public com.google.common.util.concurrent.ListenableFuture<CloseableIterator<TaskStatusPlus>> taskStatuses(@Nullable String state, @Nullable String dataSource, @Nullable Integer maxCompletedTasks) Description copied from interface:OverlordClientReturnTaskStatusPlusfor all tasks matching a set of optional search parameters. Complete tasks are returned in descending order by creation timestamp. Active tasks are returned in no particular order.- Specified by:
taskStatusesin interfaceOverlordClient- Parameters:
state- task state: may be "pending", "waiting", "running", or "complete"dataSource- datasourcemaxCompletedTasks- maximum number of completed tasks to return. If zero, no complete tasks are returned. If null, all complete tasks withindruid.indexer.storage.recentlyFinishedThresholdare returned. This parameter does not affect the number of active tasks returned.- Returns:
- list of tasks that match the search parameters
-
taskStatuses
public com.google.common.util.concurrent.ListenableFuture<Map<String,TaskStatus>> taskStatuses(Set<String> taskIds) Description copied from interface:OverlordClientReturnTaskStatusfor a set of task IDs.- Specified by:
taskStatusesin interfaceOverlordClient- Parameters:
taskIds- task IDs- Returns:
- map of task ID to status for known tasks. Unknown tasks are not included in the returned map.
-
taskStatus
public com.google.common.util.concurrent.ListenableFuture<TaskStatusResponse> taskStatus(String taskId) Description copied from interface:OverlordClientReturnsTaskStatusResponsefor a particular task ID. This includes somewhat more information than theTaskStatusreturned byOverlordClient.taskStatuses(Set).- Specified by:
taskStatusin interfaceOverlordClient
-
findLockedIntervals
public com.google.common.util.concurrent.ListenableFuture<Map<String,List<org.joda.time.Interval>>> findLockedIntervals(List<LockFilterPolicy> lockFilterPolicies) Description copied from interface:OverlordClientReturns a list of intervals locked by higher priority conflicting lock types- Specified by:
findLockedIntervalsin interfaceOverlordClient- Parameters:
lockFilterPolicies- List of all filters for different datasources- Returns:
- Map from datasource name to list of intervals locked by tasks that have a conflicting lock type with
priority greater than or equal to the
minTaskPriorityfor that datasource.
-
taskReportAsMap
public com.google.common.util.concurrent.ListenableFuture<TaskReport.ReportMap> taskReportAsMap(String taskId) Description copied from interface:OverlordClientReturns the report object for a task as a map. Certain task types offer live reports; for these task types, this method may return a task report while the task is running. Certain task types only write reports upon successful completion. Certain other task types do not write reports at all. Returns aHttpResponseExceptionwith codeResponse.Status.NOT_FOUNDif there is no report available for some reason.- Specified by:
taskReportAsMapin interfaceOverlordClient
-
postSupervisor
public com.google.common.util.concurrent.ListenableFuture<Map<String,String>> postSupervisor(SupervisorSpec supervisor) Description copied from interface:OverlordClientSubmits a supervisor spec to the Overlord.API:
/druid/indexer/v1/supervisor- Specified by:
postSupervisorin interfaceOverlordClient- Returns:
- Map containing a single entry "id"
-
terminateSupervisor
public com.google.common.util.concurrent.ListenableFuture<Map<String,String>> terminateSupervisor(String supervisorId) Description copied from interface:OverlordClientShuts down a supervisor.API:
/druid/indexer/v1/supervisor/<id>/terminate- Specified by:
terminateSupervisorin interfaceOverlordClient- Returns:
- Map containing a single entry "id"
-
supervisorStatuses
public com.google.common.util.concurrent.ListenableFuture<CloseableIterator<SupervisorStatus>> supervisorStatuses()Description copied from interface:OverlordClientReturns all current supervisor statuses.- Specified by:
supervisorStatusesin interfaceOverlordClient
-
getWorkers
Description copied from interface:OverlordClientReturns information about workers.- Specified by:
getWorkersin interfaceOverlordClient
-
getTotalWorkerCapacity
public com.google.common.util.concurrent.ListenableFuture<IndexingTotalWorkerCapacityInfo> getTotalWorkerCapacity()Description copied from interface:OverlordClientReturns total worker capacity details.- Specified by:
getTotalWorkerCapacityin interfaceOverlordClient
-
killPendingSegments
public com.google.common.util.concurrent.ListenableFuture<Integer> killPendingSegments(String dataSource, org.joda.time.Interval interval) Description copied from interface:OverlordClientDeletes pending segment records from the metadata store for a particular datasource. Records withcreated_datewithin the providedintervalare deleted; other records are left alone. Deletion is done synchronously with the API call. When the future resolves, the deletion is complete.- Specified by:
killPendingSegmentsin interfaceOverlordClient- Parameters:
dataSource- datasource nameinterval- created time interval- Returns:
- number of pending segments deleted
-
taskPayload
public com.google.common.util.concurrent.ListenableFuture<TaskPayloadResponse> taskPayload(String taskId) Description copied from interface:OverlordClientReturns the payload for a task as an instance ofClientTaskQuery. This method only works for tasks that have aClientTaskQuerymodel or are subclasses ofClientTaskQuery.- Specified by:
taskPayloadin interfaceOverlordClient
-
markNonOvershadowedSegmentsAsUsed
public com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse> markNonOvershadowedSegmentsAsUsed(String dataSource) Description copied from interface:OverlordClientMarks all non-overshadowed segments of the datasource as used.API:
POST /druid/indexer/v1/datasources/{dataSourceName}- Specified by:
markNonOvershadowedSegmentsAsUsedin interfaceOverlordClient
-
markNonOvershadowedSegmentsAsUsed
public com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse> markNonOvershadowedSegmentsAsUsed(String dataSource, SegmentsToUpdateFilter filter) Description copied from interface:OverlordClientMarks non-overshadowed segments that satisfy the given filter as used.API:
POST /druid/indexer/v1/datasources/{dataSourceName}/markUsed- Specified by:
markNonOvershadowedSegmentsAsUsedin interfaceOverlordClientfilter- Must be non-null
-
markSegmentAsUsed
public com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse> markSegmentAsUsed(SegmentId segmentId) Description copied from interface:OverlordClientMarks the given segment as used.API:
POST /druid/indexer/v1/datasources/{dataSourceName}/segments/{segmentId}- Specified by:
markSegmentAsUsedin interfaceOverlordClient
-
markSegmentsAsUnused
public com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse> markSegmentsAsUnused(String dataSource) Description copied from interface:OverlordClientMarks all non-overshadowed segments of the datasource as unused.API:
DELETE /druid/indexer/v1/datasources/{dataSourceName}- Specified by:
markSegmentsAsUnusedin interfaceOverlordClient
-
markSegmentsAsUnused
public com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse> markSegmentsAsUnused(String dataSource, SegmentsToUpdateFilter filter) Description copied from interface:OverlordClientMarks non-overshadowed segments that satisfy the given filter as unused.API:
POST /druid/indexer/v1/datasources/{dataSourceName}/markUnused- Specified by:
markSegmentsAsUnusedin interfaceOverlordClientfilter- Must be non-null
-
markSegmentAsUnused
public com.google.common.util.concurrent.ListenableFuture<SegmentUpdateResponse> markSegmentAsUnused(SegmentId segmentId) Description copied from interface:OverlordClientMarks the given segment as unused.API:
DELETE /druid/indexer/v1/datasources/{dataSourceName}/segments/{segmentId}- Specified by:
markSegmentAsUnusedin interfaceOverlordClient
-
isCompactionSupervisorEnabled
Description copied from interface:OverlordClientChecks if compaction supervisors are enabled on the Overlord. When this returns true, the Coordinator does not run CompactSegments duty.API:
GET /druid/indexer/v1/compaction/isSupervisorEnabled- Specified by:
isCompactionSupervisorEnabledin interfaceOverlordClient
-
getClusterCompactionConfig
public com.google.common.util.concurrent.ListenableFuture<ClusterCompactionConfig> getClusterCompactionConfig()Description copied from interface:OverlordClientGets the current cluster-level compaction config.API:
GET /druid/indexer/v1/compaction/config/cluster- Specified by:
getClusterCompactionConfigin interfaceOverlordClient
-
updateClusterCompactionConfig
public com.google.common.util.concurrent.ListenableFuture<UpdateResponse> updateClusterCompactionConfig(ClusterCompactionConfig config) Description copied from interface:OverlordClientGets the current cluster-level compaction config.API:
POST /druid/indexer/v1/compaction/config/cluster- Specified by:
updateClusterCompactionConfigin interfaceOverlordClient- Returns:
UpdateResponsecontaining the success status of this operation.
-
withRetryPolicy
Description copied from interface:OverlordClientReturns a copy of this client with a different retry policy.- Specified by:
withRetryPolicyin interfaceOverlordClient
-