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/16 05:55:08 UTC

[GitHub] [pulsar] AnonHxy opened a new pull request, #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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

   ### Motivation
   
   
   * Fix dispatch rate limiter doesn't be initialized on broker-level
   
   ### Modifications
   
   *  Create a method `updateDispatchRateLimiter()` to initialize the dispatch rate limiter and update it.
   
   ### Verifying this change
   
   - [x] Make sure that the change passes the CI checks.
   
   
   This change added tests and can be verified as follows:
   
     - *Added UT `TopicDispatchRateLimiterTest`*
   
   ### Documentation
   
   Check the box below or label this PR directly.
   
   Need to update docs? 
   
     
   - [x] `doc-not-needed` 


-- 
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] AnonHxy commented on pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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

   > @AnonHxy Could you please help open a PR for branch-2.10 since I'm not able to cherry-pick it directly.
   
   OK, I am working on this.


-- 
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] AnonHxy commented on a diff in pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2371,11 +2371,9 @@ private void updateTopicMessageDispatchRate() {
         this.pulsar().getExecutor().execute(() -> {
             // update message-rate for each topic
             forEachTopic(topic -> {
-                if (topic instanceof AbstractTopic) {
-                    ((AbstractTopic) topic).updateBrokerDispatchRate();
-                }
-                if (topic.getDispatchRateLimiter().isPresent()) {
-                    topic.getDispatchRateLimiter().get().updateDispatchRate();
+                if (topic instanceof PersistentTopic) {

Review Comment:
   > Further more, we can add dispatchRateLimiter for non-persistent-topic in the future
   I looks better if we add `updateDispatchRateLimiter()` as `AbstractTopic` method. @Jason918 



-- 
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] AnonHxy commented on pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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

   /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] codelipenghui commented on pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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

   @AnonHxy Done


-- 
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] AnonHxy commented on pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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

   @Technoboy- @codelipenghui  PTAL~,  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] AnonHxy commented on pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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

   /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] Jason918 commented on a diff in pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2371,11 +2371,9 @@ private void updateTopicMessageDispatchRate() {
         this.pulsar().getExecutor().execute(() -> {
             // update message-rate for each topic
             forEachTopic(topic -> {
-                if (topic instanceof AbstractTopic) {
-                    ((AbstractTopic) topic).updateBrokerDispatchRate();
-                }
-                if (topic.getDispatchRateLimiter().isPresent()) {
-                    topic.getDispatchRateLimiter().get().updateDispatchRate();
+                if (topic instanceof PersistentTopic) {

Review Comment:
   No `updateBrokerDispatchRate()` for non-persistent-topic ? 



-- 
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] AnonHxy commented on a diff in pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2371,11 +2371,9 @@ private void updateTopicMessageDispatchRate() {
         this.pulsar().getExecutor().execute(() -> {
             // update message-rate for each topic
             forEachTopic(topic -> {
-                if (topic instanceof AbstractTopic) {
-                    ((AbstractTopic) topic).updateBrokerDispatchRate();
-                }
-                if (topic.getDispatchRateLimiter().isPresent()) {
-                    topic.getDispatchRateLimiter().get().updateDispatchRate();
+                if (topic instanceof PersistentTopic) {

Review Comment:
   > Further more, we can add dispatchRateLimiter for non-persistent-topic in the future
   
   
   It looks better if we add `updateDispatchRateLimiter()` as `AbstractTopic` method. @Jason918 



-- 
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] codelipenghui commented on pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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

   @AnonHxy Could you please help open a PR for branch-2.10 since I'm not able to cherry-pick it directly.


-- 
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] Jason918 commented on a diff in pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2371,11 +2371,9 @@ private void updateTopicMessageDispatchRate() {
         this.pulsar().getExecutor().execute(() -> {
             // update message-rate for each topic
             forEachTopic(topic -> {
-                if (topic instanceof AbstractTopic) {
-                    ((AbstractTopic) topic).updateBrokerDispatchRate();
-                }
-                if (topic.getDispatchRateLimiter().isPresent()) {
-                    topic.getDispatchRateLimiter().get().updateDispatchRate();
+                if (topic instanceof PersistentTopic) {

Review Comment:
   But `updateBrokerDispatchRate()` is in `AbstractTopic` and works for non-persistent topic.
   Further more, we can add dispatchRateLimiter for non-persistent-topic in the future.



-- 
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] AnonHxy commented on a diff in pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2371,11 +2371,9 @@ private void updateTopicMessageDispatchRate() {
         this.pulsar().getExecutor().execute(() -> {
             // update message-rate for each topic
             forEachTopic(topic -> {
-                if (topic instanceof AbstractTopic) {
-                    ((AbstractTopic) topic).updateBrokerDispatchRate();
-                }
-                if (topic.getDispatchRateLimiter().isPresent()) {
-                    topic.getDispatchRateLimiter().get().updateDispatchRate();
+                if (topic instanceof PersistentTopic) {

Review Comment:
   > Further more, we can add dispatchRateLimiter for non-persistent-topic in the future
   
   
   I looks better if we add `updateDispatchRateLimiter()` as `AbstractTopic` method. @Jason918 



-- 
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] codelipenghui merged pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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


-- 
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] AnonHxy commented on a diff in pull request #16084: [Fix][broker]Fix topic dispatch rate limiter not init on broker-level

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


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -2371,11 +2371,9 @@ private void updateTopicMessageDispatchRate() {
         this.pulsar().getExecutor().execute(() -> {
             // update message-rate for each topic
             forEachTopic(topic -> {
-                if (topic instanceof AbstractTopic) {
-                    ((AbstractTopic) topic).updateBrokerDispatchRate();
-                }
-                if (topic.getDispatchRateLimiter().isPresent()) {
-                    topic.getDispatchRateLimiter().get().updateDispatchRate();
+                if (topic instanceof PersistentTopic) {

Review Comment:
   Yes. Because `dispatchRateLimiter` is private in `PersistentTopic`, so I think it 's ok just updating `PersistentTopic` dispatch rate @Jason918 



-- 
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