fjy closed pull request #6612: [Backport] Remove unnecessary path param from
auto compaction api
URL: https://github.com/apache/incubator-druid/pull/6612
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/docs/content/configuration/index.md
b/docs/content/configuration/index.md
index 5a75b16036c..42e3105a1ed 100644
--- a/docs/content/configuration/index.md
+++ b/docs/content/configuration/index.md
@@ -795,13 +795,11 @@ An example of compaction config is:
```json
{
- "dataSource": "wikiticker",
- "targetCompactionSizeBytes": 800000000,
- "skipOffsetFromLatest": "P1D"
+ "dataSource": "wikiticker"
}
```
-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
diff --git a/docs/content/operations/api-reference.md
b/docs/content/operations/api-reference.md
index c2a43b37c96..b51f937bfc9 100644
--- a/docs/content/operations/api-reference.md
+++ b/docs/content/operations/api-reference.md
@@ -292,7 +292,7 @@ Returns total size and count for each datasource for each
interval within given
#### GET
-* `/druid/coordinator/v1/config/compaction/`
+* `/druid/coordinator/v1/config/compaction`
Returns all compaction configs.
@@ -302,15 +302,15 @@ Returns a compaction config of a dataSource.
#### 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.
-The actual max number of compaction tasks is `min(maxSlots, slotRatio * total
task slots)`.
-Note that `slotRatio` and `maxSlots` are optional and can be omitted. If they
are omitted, default values (0.1 and unbounded)
+The actual max number of compaction tasks is `min(max, ratio * total task
slots)`.
+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.
-* `/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.
diff --git
a/server/src/main/java/org/apache/druid/server/http/CoordinatorCompactionConfigsResource.java
b/server/src/main/java/org/apache/druid/server/http/CoordinatorCompactionConfigsResource.java
index d01fbec0ae1..46044037bc8 100644
---
a/server/src/main/java/org/apache/druid/server/http/CoordinatorCompactionConfigsResource.java
+++
b/server/src/main/java/org/apache/druid/server/http/CoordinatorCompactionConfigsResource.java
@@ -27,7 +27,6 @@
import org.apache.druid.audit.AuditManager;
import org.apache.druid.common.config.ConfigManager.SetResult;
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.DataSourceCompactionConfig;
import org.apache.druid.server.http.security.ConfigResourceFilter;
@@ -75,10 +74,11 @@ public Response getCompactConfig()
}
@POST
+ @Path("/taskslots")
@Consumes(MediaType.APPLICATION_JSON)
public Response setCompactionTaskLimit(
- @QueryParam("slotRatio") Double compactionTaskSlotRatio,
- @QueryParam("maxSlots") Integer maxCompactionTaskSlots,
+ @QueryParam("ratio") Double compactionTaskSlotRatio,
+ @QueryParam("max") Integer maxCompactionTaskSlots,
@HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String
author,
@HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final
String comment,
@Context HttpServletRequest req
@@ -112,29 +112,14 @@ public Response setCompactionTaskLimit(
}
@POST
- @Path("/{dataSource}")
@Consumes(MediaType.APPLICATION_JSON)
public Response addOrUpdateCompactionConfig(
final DataSourceCompactionConfig newConfig,
- @PathParam("dataSource") String dataSource,
@HeaderParam(AuditManager.X_DRUID_AUTHOR) @DefaultValue("") final String
author,
@HeaderParam(AuditManager.X_DRUID_COMMENT) @DefaultValue("") final
String comment,
@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.CONFIG_KEY,
CoordinatorCompactionConfig.class
@@ -146,7 +131,7 @@ public Response addOrUpdateCompactionConfig(
.getCompactionConfigs()
.stream()
.collect(Collectors.toMap(DataSourceCompactionConfig::getDataSource,
Function.identity()));
- newConfigs.put(dataSource, newConfig);
+ newConfigs.put(newConfig.getDataSource(), newConfig);
newCompactionConfig = CoordinatorCompactionConfig.from(current,
ImmutableList.copyOf(newConfigs.values()));
} else {
newCompactionConfig =
CoordinatorCompactionConfig.from(ImmutableList.of(newConfig));
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]