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 2020/05/29 05:32:37 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #7078: introduce precise topic publish rate limiting

merlimat commented on a change in pull request #7078:
URL: https://github.com/apache/pulsar/pull/7078#discussion_r432263968



##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/PublishRateLimiter.java
##########
@@ -66,6 +69,83 @@
      * @param clusterName
      */
     void update(PublishRate maxPublishRate);
+
+    /**
+     * try to acquire permit
+     * @param numbers
+     * @param bytes
+     * */
+    boolean tryAcquire(int numbers, long bytes);
+}
+
+class PrecisPublishLimiter implements PublishRateLimiter {
+    protected volatile int publishMaxMessageRate = 0;

Review comment:
       I'd say in general to avoid volatile in all cases in which the exact semantic of read after write consistency is required. In this case we can probably just rely on dirty reads




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

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