Package org.apache.druid.server.http
Class SegmentListerResource
- java.lang.Object
-
- org.apache.druid.server.http.SegmentListerResource
-
public class SegmentListerResource extends Object
Endpoints exposed here are to be used only for druid internal management of segments by Coordinators, Brokers etc.
-
-
Field Summary
Fields Modifier and Type Field Description protected com.fasterxml.jackson.databind.ObjectMapperjsonMapperprotected static org.apache.druid.java.util.emitter.EmittingLoggerlogprotected com.fasterxml.jackson.databind.ObjectMappersmileMapper
-
Constructor Summary
Constructors Constructor Description SegmentListerResource(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, com.fasterxml.jackson.databind.ObjectMapper smileMapper, BatchDataSegmentAnnouncer announcer, SegmentLoadDropHandler loadDropRequestHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyDataSegmentChangeRequests(long timeout, List<DataSegmentChangeRequest> changeRequestList, javax.servlet.http.HttpServletRequest req)This endpoint is used by HttpLoadQueuePeon to assign segment load/drop requests batch.VoidgetSegments(long counter, long hash, long timeout, javax.servlet.http.HttpServletRequest req)This endpoint is used by HttpServerInventoryView to keep an up-to-date list of segments served by historical/realtime nodes.
-
-
-
Constructor Detail
-
SegmentListerResource
@Inject public SegmentListerResource(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, com.fasterxml.jackson.databind.ObjectMapper smileMapper, @Nullable BatchDataSegmentAnnouncer announcer, @Nullable SegmentLoadDropHandler loadDropRequestHandler)
-
-
Method Detail
-
getSegments
public Void getSegments(long counter, long hash, long timeout, @Context javax.servlet.http.HttpServletRequest req) throws IOException
This endpoint is used by HttpServerInventoryView to keep an up-to-date list of segments served by historical/realtime nodes. This endpoint lists segments served by this server and can also incrementally provide the segments added/dropped since last response. Here is how, this is used. (1) Client sends first request /druid/internal/v1/segments?counter=-1&timeout=Server responds with list of segments currently served and a pair. (2) Client sends subsequent requests /druid/internal/v1/segments?counter= &hash= &timeout= Where values are used from the last response. Server responds with list of segment updates since given counter. This endpoint makes the client wait till either there is some segment update or given timeout elapses. So, clients keep on sending next request immediately after receiving the response in order to keep the list of segments served by this server up-to-date. - Parameters:
counter- counter received in last response.hash- hash received in last response.timeout- after which response is sent even if there are no new segment updates.req-- Returns:
- null to avoid "MUST return a non-void type" warning.
- Throws:
IOException
-
applyDataSegmentChangeRequests
public void applyDataSegmentChangeRequests(long timeout, List<DataSegmentChangeRequest> changeRequestList, @Context javax.servlet.http.HttpServletRequest req) throws IOExceptionThis endpoint is used by HttpLoadQueuePeon to assign segment load/drop requests batch. This endpoint makes the client wait till one of the following events occur. Note that this is implemented using async IO so no jetty threads are held while in wait. (1) Given timeout elapses. (2) Some load/drop request completed. It returns a map of "load/drop request -> SUCCESS/FAILED/PENDING status" for each request in the batch.- Throws:
IOException
-
-