vogievetsky commented on code in PR #14772: URL: https://github.com/apache/druid/pull/14772#discussion_r1295119337
########## docs/api-reference/supervisor-api.md: ########## @@ -3030,6 +3030,86 @@ Host: http://ROUTER_IP:ROUTER_PORT ``` </details> +### Reset Offsets for a supervisor + +Resets the specified offsets for a supervisor. This endpoint clears _only_ the specified offsets in Kafka or sequence numbers in Kinesis, prompting the supervisor to resume data reading. +The supervisor will start from the specified reset offsets for the partitions specified and for the other partitions from the stored offset. It kills and recreates active tasks pertaining to +the partitions specified to read from valid offsets. + +Use this endpoint to selectively reset offsets for partitions without resetting the entire set. + +#### URL + +<code class="postAPI">POST</code> <code>/druid/indexer/v1/supervisor/:supervisorId/resetOffsets</code> + +#### Responses + +<!--DOCUSAURUS_CODE_TABS--> + +<!--200 SUCCESS--> + +*Successfully reset offsets* + +<!--404 NOT FOUND--> + +*Invalid supervisor ID* + +<!--END_DOCUSAURUS_CODE_TABS--> + +--- + +#### Sample request + +The following example shows how to reset offsets for a kafka supervisor with the name `social_media`. Let's say the supervisor is reading +from a kafka topic `ads_media_stream` and has the stored offsets: `{"0": 0, "1": 10, "2": 20, "3": 40}`. + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> + +```shell +curl --request POST "http://ROUTER_IP:ROUTER_PORT/druid/indexer/v1/supervisor/social_media/resetOffsets" +--header 'Content-Type: application/json' +--data-raw '{"type":"kafka","partitions":{"type":"end","stream":"ads_media_stream","partitionOffsetMap":{"0":100, "2": 650}}}' +``` + +The above operation will reset offsets only for partitions 0 and 2 to 100 and 650 respectively. After a successful reset, +when the supervisor's tasks restart, they will resume reading from `{"0": 100, "1": 10, "2": 650, "3": 40}`. + +<!--HTTP--> + +```HTTP +POST /druid/indexer/v1/supervisor/social_media/resetOffsets HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +Content-Type: application/json + +{ + "type": "kafka", + "partitions": { + "type": "end", Review Comment: What is `"type": "end",` ? where is it documented? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
