mirror of https://github.com/apache/druid.git
Remove unnecessary path param from auto compaction api (#6594)
* Remove unnecessary path param from auto compaction api * fix ci
This commit is contained in:
parent
afb239b17a
commit
7b262b7123
|
@ -815,13 +815,11 @@ An example of compaction config is:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"dataSource": "wikiticker",
|
"dataSource": "wikiticker"
|
||||||
"targetCompactionSizeBytes": 800000000,
|
|
||||||
"skipOffsetFromLatest": "P1D"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
For realtime dataSources, it's recommended to set `skipOffsetFromLatest` to some sufficiently large values to avoid frequent compact task failures.
|
For realtime dataSources, it's recommended to set `skipOffsetFromLatest` to some sufficiently large value to avoid frequent compact task failures.
|
||||||
|
|
||||||
## Overlord
|
## Overlord
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,7 @@ Returns total size and count for each datasource for each interval within given
|
||||||
|
|
||||||
#### GET
|
#### GET
|
||||||
|
|
||||||
* `/druid/coordinator/v1/config/compaction/`
|
* `/druid/coordinator/v1/config/compaction`
|
||||||
|
|
||||||
Returns all compaction configs.
|
Returns all compaction configs.
|
||||||
|
|
||||||
|
@ -321,15 +321,15 @@ Returns a compaction config of a dataSource.
|
||||||
|
|
||||||
#### POST
|
#### POST
|
||||||
|
|
||||||
* `/druid/coordinator/v1/config/compaction?slotRatio={someRatio}&maxSlots={someMaxSlots}`
|
* `/druid/coordinator/v1/config/compaction/taskslots?ratio={someRatio}&max={someMaxSlots}`
|
||||||
|
|
||||||
Update the capacity for compaction tasks. `slotRatio` and `maxSlots` are used to limit the max number of compaction tasks.
|
Update the capacity for compaction tasks. `ratio` and `max` are used to limit the max number of compaction tasks.
|
||||||
They mean the ratio of the total task slots to the copmaction task slots and the maximum number of task slots for compaction tasks, respectively.
|
They mean the ratio of the total task slots to the copmaction task slots and the maximum number of task slots for compaction tasks, respectively.
|
||||||
The actual max number of compaction tasks is `min(maxSlots, slotRatio * total task slots)`.
|
The actual max number of compaction tasks is `min(max, ratio * total task slots)`.
|
||||||
Note that `slotRatio` and `maxSlots` are optional and can be omitted. If they are omitted, default values (0.1 and unbounded)
|
Note that `ratio` and `max` are optional and can be omitted. If they are omitted, default values (0.1 and unbounded)
|
||||||
will be set for them.
|
will be set for them.
|
||||||
|
|
||||||
* `/druid/coordinator/v1/config/compaction/{dataSource}`
|
* `/druid/coordinator/v1/config/compaction`
|
||||||
|
|
||||||
Creates or updates the compaction config for a dataSource. See [Compaction Configuration](../configuration/index.html#compaction-dynamic-configuration) for configuration details.
|
Creates or updates the compaction config for a dataSource. See [Compaction Configuration](../configuration/index.html#compaction-dynamic-configuration) for configuration details.
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ import org.apache.druid.audit.AuditInfo;
|
||||||
import org.apache.druid.audit.AuditManager;
|
import org.apache.druid.audit.AuditManager;
|
||||||
import org.apache.druid.common.config.ConfigManager.SetResult;
|
import org.apache.druid.common.config.ConfigManager.SetResult;
|
||||||
import org.apache.druid.common.config.JacksonConfigManager;
|
import org.apache.druid.common.config.JacksonConfigManager;
|
||||||
import org.apache.druid.java.util.common.StringUtils;
|
|
||||||
import org.apache.druid.server.coordinator.CoordinatorCompactionConfig;
|
import org.apache.druid.server.coordinator.CoordinatorCompactionConfig;
|
||||||
import org.apache.druid.server.coordinator.DataSourceCompactionConfig;
|
import org.apache.druid.server.coordinator.DataSourceCompactionConfig;
|
||||||
import org.apache.druid.server.http.security.ConfigResourceFilter;
|
import org.apache.druid.server.http.security.ConfigResourceFilter;
|
||||||
|
@ -75,10 +74,11 @@ public class CoordinatorCompactionConfigsResource
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
|
@Path("/taskslots")
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public Response setCompactionTaskLimit(
|
public Response setCompactionTaskLimit(
|
||||||
@QueryParam("slotRatio") Double compactionTaskSlotRatio,
|
@QueryParam("ratio") Double compactionTaskSlotRatio,
|
||||||
@QueryParam("maxSlots") Integer maxCompactionTaskSlots,
|
@QueryParam("max") Integer maxCompactionTaskSlots,
|
||||||
@HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author,
|
@HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author,
|
||||||
@HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment,
|
@HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment,
|
||||||
@Context HttpServletRequest req
|
@Context HttpServletRequest req
|
||||||
|
@ -112,29 +112,14 @@ public class CoordinatorCompactionConfigsResource
|
||||||
}
|
}
|
||||||
|
|
||||||
@POST
|
@POST
|
||||||
@Path("/{dataSource}")
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
public Response addOrUpdateCompactionConfig(
|
public Response addOrUpdateCompactionConfig(
|
||||||
final DataSourceCompactionConfig newConfig,
|
final DataSourceCompactionConfig newConfig,
|
||||||
@PathParam("dataSource") String dataSource,
|
|
||||||
@HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author,
|
@HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String author,
|
||||||
@HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment,
|
@HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final String comment,
|
||||||
@Context HttpServletRequest req
|
@Context HttpServletRequest req
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!dataSource.equals(newConfig.getDataSource())) {
|
|
||||||
return Response
|
|
||||||
.status(Response.Status.BAD_REQUEST)
|
|
||||||
.entity(
|
|
||||||
StringUtils.format(
|
|
||||||
"dataSource[%s] in config is different from the requested one[%s]",
|
|
||||||
newConfig.getDataSource(),
|
|
||||||
dataSource
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
CoordinatorCompactionConfig current = manager.watch(
|
CoordinatorCompactionConfig current = manager.watch(
|
||||||
CoordinatorCompactionConfig.CONFIG_KEY,
|
CoordinatorCompactionConfig.CONFIG_KEY,
|
||||||
CoordinatorCompactionConfig.class
|
CoordinatorCompactionConfig.class
|
||||||
|
@ -146,7 +131,7 @@ public class CoordinatorCompactionConfigsResource
|
||||||
.getCompactionConfigs()
|
.getCompactionConfigs()
|
||||||
.stream()
|
.stream()
|
||||||
.collect(Collectors.toMap(DataSourceCompactionConfig::getDataSource, Function.identity()));
|
.collect(Collectors.toMap(DataSourceCompactionConfig::getDataSource, Function.identity()));
|
||||||
newConfigs.put(dataSource, newConfig);
|
newConfigs.put(newConfig.getDataSource(), newConfig);
|
||||||
newCompactionConfig = CoordinatorCompactionConfig.from(current, ImmutableList.copyOf(newConfigs.values()));
|
newCompactionConfig = CoordinatorCompactionConfig.from(current, ImmutableList.copyOf(newConfigs.values()));
|
||||||
} else {
|
} else {
|
||||||
newCompactionConfig = CoordinatorCompactionConfig.from(ImmutableList.of(newConfig));
|
newCompactionConfig = CoordinatorCompactionConfig.from(ImmutableList.of(newConfig));
|
||||||
|
|
Loading…
Reference in New Issue