Class 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 Detail

      • log

        protected static final org.apache.druid.java.util.emitter.EmittingLogger log
      • jsonMapper

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

        protected final com.fasterxml.jackson.databind.ObjectMapper smileMapper
    • 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 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