You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/06/01 13:46:30 UTC

[GitHub] [pulsar] gaoyanliang opened a new pull request, #15880: Async subscription dispatch rate

gaoyanliang opened a new pull request, #15880:
URL: https://github.com/apache/pulsar/pull/15880

   ### Motivation
   
   See PIP https://github.com/apache/pulsar/issues/14365 and change tracker https://github.com/apache/pulsar/issues/15043.
   
   MakesetSubscriptionDispatchRate / getSubscriptionDispatchRate / deleteSubscriptionDispatchRate methods to pure async.
   
   
   ### Documentation
   
   - [x] `no-need-doc` 
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: Async subscription dispatch rate

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1143636719

   @shibd @Technoboy- @mattisonchao  PTAL


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1144392370

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Technoboy- commented on a diff in pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#discussion_r887420405


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java:
##########
@@ -864,11 +872,19 @@ public void setSubscriptionDispatchRate(@PathParam("property") String property,
             + "in dispatch-rate yet")
     @ApiResponses(value = {@ApiResponse(code = 403, message = "Don't have admin permission"),
             @ApiResponse(code = 404, message = "Namespace does not exist")})
-    public DispatchRate getSubscriptionDispatchRate(@PathParam("property") String property,
-                                                    @PathParam("cluster") String cluster,
-                                                    @PathParam("namespace") String namespace) {
+    public void getSubscriptionDispatchRate(@Suspended AsyncResponse asyncResponse,
+                                            @PathParam("property") String property,
+                                            @PathParam("cluster") String cluster,
+                                            @PathParam("namespace") String namespace) {
         validateNamespaceName(property, cluster, namespace);
-        return internalGetSubscriptionDispatchRate();
+        internalGetSubscriptionDispatchRateAsync()
+                .thenAccept(asyncResponse::resume)
+                .exceptionally(ex -> {
+                    log.error("Failed to get the subscription dispatchRate for cluster on namespace {}"
+                            , namespaceName, ex);
+                    resumeAsyncResponseExceptionally(asyncResponse, ex);

Review Comment:
   and here.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java:
##########
@@ -877,11 +893,19 @@ public DispatchRate getSubscriptionDispatchRate(@PathParam("property") String pr
     @ApiResponses(value = {@ApiResponse(code = 403, message = "Don't have admin permission"),
             @ApiResponse(code = 404, message = "Property or cluster or namespace doesn't exist"),
             @ApiResponse(code = 409, message = "Concurrent modification")})
-    public void deleteSubscriptionDispatchRate(@PathParam("property") String property,
+    public void deleteSubscriptionDispatchRate(@Suspended AsyncResponse asyncResponse,
+                                               @PathParam("property") String property,
                                                @PathParam("cluster") String cluster,
                                                @PathParam("namespace") String namespace) {
         validateNamespaceName(property, cluster, namespace);
-        internalDeleteSubscriptionDispatchRate();
+        internalDeleteSubscriptionDispatchRateAsync()
+                .thenAccept(__ -> asyncResponse.resume(Response.noContent().build()))
+                .exceptionally(ex -> {
+                    log.error("Failed to delete the subscription dispatchRate for cluster on namespace {}"
+                            , namespaceName, ex);

Review Comment:
   and here



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1152062401

   Please give me some feedback if you have any questions about this task. @Technoboy- @mattisonchao  @shibd 


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1153434168

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] shibd commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
shibd commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1143809238

   @gaoyanliang CI should be able to trigger automatically because you are not submitting pr for the first time.
   
   When the ci job failed, you can use cmd`/pulsarbot run-failure-checks` to rerun these jobs(write in the comment area).
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1146934915

   @Technoboy-  @mattisonchao  ptal.
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1147334537

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1148108348

   @Technoboy-  @mattisonchao  All checks have passed. PTAL


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] RobertIndie commented on a diff in pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
RobertIndie commented on code in PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#discussion_r898646588


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/NamespacesBase.java:
##########
@@ -1385,46 +1385,32 @@ protected CompletableFuture<DispatchRate> internalGetTopicDispatchRateAsync() {
                 .thenApply(policies -> policies.topicDispatchRate.get(pulsar().getConfiguration().getClusterName()));
     }
 
-    protected void internalSetSubscriptionDispatchRate(DispatchRateImpl dispatchRate) {
-        validateSuperUserAccess();
-        log.info("[{}] Set namespace subscription dispatch-rate {}/{}", clientAppId(), namespaceName, dispatchRate);
-
-        try {
-            updatePolicies(namespaceName, (policies) -> {
-                policies.subscriptionDispatchRate.put(pulsar().getConfiguration().getClusterName(), dispatchRate);
-                return policies;
-            });
-            log.info("[{}] Successfully updated the subscriptionDispatchRate for cluster on namespace {}",
-                    clientAppId(), namespaceName);
-        } catch (Exception e) {
-            log.error("[{}] Failed to update the subscriptionDispatchRate for cluster on namespace {}", clientAppId(),
-                    namespaceName, e);
-            throw new RestException(e);
-        }
+    protected CompletableFuture<Void> internalSetSubscriptionDispatchRateAsync(DispatchRateImpl dispatchRate) {
+        return validateSuperUserAccessAsync()
+                .thenCompose(__ -> updatePoliciesAsync(namespaceName, policies -> {
+                    policies.subscriptionDispatchRate.put(pulsar().getConfiguration().getClusterName(), dispatchRate);
+                    log.info("[{}] Successfully updated the subscriptionDispatchRate for cluster on namespace {}",
+                            clientAppId(), namespaceName);
+                    return policies;
+                }));
     }
 
-    protected void internalDeleteSubscriptionDispatchRate() {
-        validateSuperUserAccess();
-
-        try {
-            updatePolicies(namespaceName, policies -> {
-                policies.subscriptionDispatchRate.remove(pulsar().getConfiguration().getClusterName());
-                return policies;
-            });
-            log.info("[{}] Successfully delete the subscriptionDispatchRate for cluster on namespace {}",
-                    clientAppId(), namespaceName);
-        } catch (Exception e) {
-            log.error("[{}] Failed to delete the subscriptionDispatchRate for cluster on namespace {}", clientAppId(),
-                    namespaceName, e);
-            throw new RestException(e);
-        }
+    protected CompletableFuture<Void> internalDeleteSubscriptionDispatchRateAsync() {
+        return validateSuperUserAccessAsync()
+                .thenCompose(__ -> updatePoliciesAsync(namespaceName, policies -> {
+                    policies.subscriptionDispatchRate.remove(pulsar().getConfiguration().getClusterName());
+                    log.info("[{}] Successfully delete the subscriptionDispatchRate for cluster on namespace {}",
+                            clientAppId(), namespaceName);
+                    return policies;
+                }));
     }
 
-    protected DispatchRate internalGetSubscriptionDispatchRate() {
+    protected CompletableFuture<DispatchRate> internalGetSubscriptionDispatchRateAsync() {
         validateNamespacePolicyOperation(namespaceName, PolicyName.RATE, PolicyOperation.READ);

Review Comment:
   Need to remove this line.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] github-actions[bot] commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1143645992

   @gaoyanliang:Thanks for your contribution. For this PR, do we need to update docs?
   (The [PR template contains info about doc](https://github.com/apache/pulsar/blob/master/.github/PULL_REQUEST_TEMPLATE.md#documentation), which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1144312333

   > @gaoyanliang CI should be able to trigger automatically because you are not submitting pr for the first time.
   > 
   > When the ci job failed, you can use cmd`/pulsarbot run-failure-checks` to rerun these jobs(write in the comment area).
   
   ok, get it. Thanks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1143640487

   Hi @Technoboy- Can you help trigger the ci ?


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Technoboy- commented on a diff in pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#discussion_r887420490


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java:
##########
@@ -797,12 +797,21 @@ public DispatchRate getDispatchRate(@PathParam("tenant") String tenant,
     @Path("/{tenant}/{namespace}/subscriptionDispatchRate")
     @ApiOperation(value = "Set Subscription dispatch-rate throttling for all topics of the namespace")
     @ApiResponses(value = {@ApiResponse(code = 403, message = "Don't have admin permission")})
-    public void setSubscriptionDispatchRate(@PathParam("tenant") String tenant,
-                                            @PathParam("namespace") String namespace, @ApiParam(value =
-            "Subscription dispatch rate for all topics of the specified namespace")
+    public void setSubscriptionDispatchRate(@Suspended AsyncResponse asyncResponse,
+                                            @PathParam("tenant") String tenant,
+                                            @PathParam("namespace") String namespace,
+                                            @ApiParam(value =
+                                            "Subscription dispatch rate for all topics of the specified namespace")
                                                         DispatchRateImpl dispatchRate) {
         validateNamespaceName(tenant, namespace);
-        internalSetSubscriptionDispatchRate(dispatchRate);
+        internalSetSubscriptionDispatchRateAsync(dispatchRate)
+                .thenAccept(__ -> asyncResponse.resume(Response.noContent().build()))
+                .exceptionally(ex -> {
+                    log.error("Failed to update the subscription dispatchRate for cluster on namespace {}"
+                            , namespaceName, ex);

Review Comment:
   and here



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1147265744

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1157228686

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1150910942

   @Technoboy- @mattisonchao  PTAL。


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1157263534

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1153358571

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1144331323

   @Technoboy-  @shibd fixed. PTAL


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] shibd commented on a diff in pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
shibd commented on code in PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#discussion_r887417675


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java:
##########
@@ -823,7 +823,7 @@ public void setDispatchRate(@PathParam("property") String property, @PathParam("
     @ApiResponses(value = {@ApiResponse(code = 403, message = "Don't have admin permission"),
             @ApiResponse(code = 404, message = "Namespace does not exist")})
     public DispatchRate getDispatchRate(@PathParam("property") String property, @PathParam("cluster") String cluster,
-            @PathParam("namespace") String namespace) {
+                                        @PathParam("namespace") String namespace) {

Review Comment:
   invalid change.



##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v2/Namespaces.java:
##########
@@ -772,7 +772,7 @@ public void deleteDispatchRate(@PathParam("tenant") String tenant, @PathParam("n
     @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"),
             @ApiResponse(code = 404, message = "Namespace does not exist") })
     public DispatchRate getDispatchRate(@PathParam("tenant") String tenant,
-            @PathParam("namespace") String namespace) {
+                                        @PathParam("namespace") String namespace) {

Review Comment:
   invalid change



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1153431895

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1157195503

   /pulsarbot run-failure-checks
   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Technoboy- merged pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
Technoboy- merged PR #15880:
URL: https://github.com/apache/pulsar/pull/15880


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Technoboy- commented on a diff in pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#discussion_r887420343


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/v1/Namespaces.java:
##########
@@ -849,12 +849,20 @@ public DispatchRate getDispatchRate(@PathParam("property") String property, @Pat
     @Path("/{property}/{cluster}/{namespace}/subscriptionDispatchRate")
     @ApiOperation(value = "Set Subscription dispatch-rate throttling for all topics of the namespace")
     @ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission") })
-    public void setSubscriptionDispatchRate(@PathParam("property") String property,
+    public void setSubscriptionDispatchRate(@Suspended AsyncResponse asyncResponse,
+                                            @PathParam("property") String property,
                                             @PathParam("cluster") String cluster,
                                             @PathParam("namespace") String namespace,
                                             DispatchRateImpl dispatchRate) {
         validateNamespaceName(property, cluster, namespace);
-        internalSetSubscriptionDispatchRate(dispatchRate);
+        internalSetSubscriptionDispatchRateAsync(dispatchRate)
+                .thenAccept(__ -> asyncResponse.resume(Response.noContent().build()))
+                .exceptionally(ex -> {
+                    log.error("Failed to set the subscription dispatchRate for cluster on namespace {}",

Review Comment:
   We add clientAppId in the log like :l
   log.error("[{}] Failed to set the subscription dispatchRate for cluster on namespace {}", clientAppId(), namespaceName, ex);



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] gaoyanliang commented on pull request #15880: [improve][broker] Make some operation subscription dispatchRate methods in Namespaces async

Posted by GitBox <gi...@apache.org>.
gaoyanliang commented on PR #15880:
URL: https://github.com/apache/pulsar/pull/15880#issuecomment-1147301726

   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org