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 Details

    • log

      protected static final EmittingLogger log
    • jsonMapper

      protected final com.fasterxml.jackson.databind.ObjectMapper jsonMapper
    • smileMapper

      protected final com.fasterxml.jackson.databind.ObjectMapper smileMapper
  • Constructor Details

    • SegmentListerResource

      @Inject public SegmentListerResource(com.fasterxml.jackson.databind.ObjectMapper jsonMapper, com.fasterxml.jackson.databind.ObjectMapper smileMapper, @Nullable BatchDataSegmentAnnouncer announcer, @Nullable SegmentLoadDropHandler loadDropRequestHandler)
  • Method Details

    • 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 <counter,hash> pair. (2) Client sends subsequent requests /druid/internal/v1/segments?counter=&hash=&timeout= Where <counter,hash> 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, @Nullable SegmentLoadingMode loadingMode, List<DataSegmentChangeRequest> changeRequestList, @Context javax.servlet.http.HttpServletRequest req) throws IOException
      This 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
    • getSegmentLoadingCapabilities

      public javax.ws.rs.core.Response getSegmentLoadingCapabilities(@Context javax.servlet.http.HttpServletRequest req)