You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by gi...@apache.org on 2018/11/13 17:46:19 UTC

[incubator-druid] branch master updated: Remove unnecessary path param from auto compaction api (#6594)

This is an automated email from the ASF dual-hosted git repository.

gian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b262b7  Remove unnecessary path param from auto compaction api (#6594)
7b262b7 is described below

commit 7b262b71230015fc89ea185adff0c8011355ef5a
Author: Jihoon Son <ji...@apache.org>
AuthorDate: Tue Nov 13 09:46:13 2018 -0800

    Remove unnecessary path param from auto compaction api (#6594)
    
    * 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 00fa96d..2694a45 100644
--- a/docs/content/configuration/index.md
+++ b/docs/content/configuration/index.md
@@ -815,13 +815,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 6a64ace..6b605f3 100644
--- a/docs/content/operations/api-reference.md
+++ b/docs/content/operations/api-reference.md
@@ -311,7 +311,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.
 
@@ -321,15 +321,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: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org