ektravel commented on code in PR #14740: URL: https://github.com/apache/druid/pull/14740#discussion_r1290618418
########## docs/api-reference/automatic-compaction-api.md: ########## @@ -23,69 +23,762 @@ sidebar_label: Automatic compaction ~ under the License. --> -This document describes status and configuration API endpoints for [automatic compaction](../data-management/automatic-compaction.md) in Apache Druid. +This topic describes status and configuration API endpoints for [automatic compaction](../data-management/automatic-compaction.md) in Apache Druid. You can configure automatic compaction in the Druid web console or API. -## Automatic compaction status +In this topic, `http://ROUTER_IP:ROUTER_PORT` is a placeholder for your Router service address and port. Replace it with the information for your deployment. For example, use `http://localhost:8888` for quickstart deployments. + +## Manage automatic compaction + +### Update capacity for compaction tasks + +Update the capacity for compaction tasks. The minimum number of compaction tasks is 1 and the maximum is 2147483652. + +#### URL + +<code class="postAPI">POST</code> <code>/druid/coordinator/v1/config/compaction/taskslots</code> + +#### Query parameters + +To limit the maximum number of compaction tasks, use the optional query parameters `ratio` and `max`: + +* `ratio` (optional) + * Type: Float + * Default: 0.1 + * Limit the ratio of the total task slots to compaction task slots. +* `max` (optional) + * Type: Int + * Default: 2147483647 + * Limit the maximum number of task slots for compaction tasks. + +#### Responses + +<!--DOCUSAURUS_CODE_TABS--> + +<!--200 SUCCESS--> + +*Successfully updated compaction configuration* + +<!--404 NOT FOUND--> + +*Invalid `max` value* + +<!--END_DOCUSAURUS_CODE_TABS--> + +--- + +#### Sample request + +<!--DOCUSAURUS_CODE_TABS--> + +<!--cURL--> + +```shell +curl --request POST "http://ROUTER_IP:ROUTER_PORT/druid/coordinator/v1/config/compaction/taskslots?ratio=0.2&max=250000" +``` + +<!--HTTP--> + +```HTTP +POST /druid/coordinator/v1/config/compaction/taskslots?ratio=0.2&max=250000 HTTP/1.1 +Host: http://ROUTER_IP:ROUTER_PORT +``` + +<!--END_DOCUSAURUS_CODE_TABS--> + +#### Sample response + +A successful request returns an HTTP `200 OK` message code and an empty response body. + +### Create or update automatic compaction configuration + +Creates or updates the automatic compaction configuration for a datasource. You pass the automatic compaction as a JSON object in the request body. + +Automatic compaction configuration require only the `dataSource` property. Druid fills all other properties with default values if not specified. See [Automatic compaction dynamic configuration](../configuration/index.md#automatic-compaction-dynamic-configuration) for configuration details. + +Note that this endpoint returns an HTTP `200 OK` message code even if the datasource name does not exist. + +#### URL + +<code class="postAPI">POST</code> <code>/druid/coordinator/v1/config/compaction</code> + +#### Responses + +<!--DOCUSAURUS_CODE_TABS--> + +<!--200 SUCCESS--> + +*Successfully submitted auto compaction configuration* + +<!--END_DOCUSAURUS_CODE_TABS--> + +--- +#### Sample request + +The following example creates an automatic compaction configuration for datasource `wikipedia_hour`. This automatic compaction configuration performs compaction on `wikipedia_hour`, resulting in compacted segments that represent a day interval of data. In this example: Review Comment: ```suggestion The following example creates an automatic compaction configuration for datasource `wikipedia_hour`. This automatic compaction configuration performs compaction on `wikipedia_hour`, resulting in compacted segments that represent a day interval of data. In this example: ``` -- 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]
