aloyszhang opened a new issue #7925:
URL: https://github.com/apache/pulsar/issues/7925
**Describe the bug**
Now, broker's publish buffer check as following
```java
foreachProducer(producer ->
currentMessagePublishBufferBytes.addAndGet(producer.getCnx().getMessagePublishBufferSize()));
...
private void foreachProducer(Consumer<Producer> consumer) {
topics.forEach((n, t) -> {
Optional<Topic> topic = extractTopic(t);
topic.ifPresent(value ->
value.getProducers().values().forEach(consumer));
});
}
```
If we have a partitioned topic and some partitions are owned by a same
broker, these partitions will share a `ServerCnx`.
In this situation, the `messagePublishBufferSize` of this `ServerCnx` will
be added for multi-times if we check the broker's publish buffer.
**To Reproduce**
Steps to reproduce the behavior:
1. start one pulsar broker
2. create a partitioned topic with more than 1 partition
3. produce some message
4. you'll see the publish buffer check of broker is not correct, the result
is partition number times of the actual used.
**Expected behavior**
we should check publish buffer of broker based on every `ServerCnx` for only
one time.
----------------------------------------------------------------
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:
[email protected]