This is an automated email from the ASF dual-hosted git repository.
fjy pushed a commit to branch 0.13.0-incubating
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git
The following commit(s) were added to refs/heads/0.13.0-incubating by this push:
new 1364144 Remove unnecessary path param from auto compaction api
(#6594) (#6612)
1364144 is described below
commit 13641444c3409c3282e4c1a9db37fb155819618a
Author: Gian Merlino <[email protected]>
AuthorDate: Tue Nov 13 14:30:48 2018 -0800
Remove unnecessary path param from auto compaction api (#6594) (#6612)
* Remove unnecessary path param from auto compaction api
* fix ci
---
docs/content/configuration/index.md | 6 ++----
docs/content/operations/api-reference.md | 12 +++++------
.../http/CoordinatorCompactionConfigsResource.java | 23 ++++------------------
3 files changed, 12 insertions(+), 29 deletions(-)
diff --git a/docs/content/configuration/index.md
b/docs/content/configuration/index.md
index 5a75b16..42e3105 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 c2a43b3..b51f937 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 d01fbec..4604403 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.AuditInfo;
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 class CoordinatorCompactionConfigsResource
}
@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 class CoordinatorCompactionConfigsResource
}
@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 class CoordinatorCompactionConfigsResource
.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));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]