heesung-sn commented on code in PR #19045:
URL: https://github.com/apache/pulsar/pull/19045#discussion_r1089662048


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:
##########
@@ -619,14 +618,13 @@ private void doCleanup(String broker) {
                     || StringUtils.equals(broker, stateData.sourceBroker())) {
                 log.info("Cleaning ownership serviceUnit:{}, stateData:{}.", 
serviceUnit, stateData);
                 tombstoneAsync(serviceUnit).whenComplete((__, e) -> {
-                    if (e == null) {
-                        serviceUnitTombstoneCnt.incrementAndGet();
-                    } else {
+                    if (e != null) {
                         log.error("Failed cleaning the ownership 
serviceUnit:{}, stateData:{}.",
                                 serviceUnit, stateData);
                         serviceUnitTombstoneErrorCnt.incrementAndGet();
                     }
                 });
+                serviceUnitTombstoneCnt.incrementAndGet();

Review Comment:
   It relies on `producer.flush()` to persist all outstanding messages before 
returning this call. 
   
   Yes, because these values could be 0, I updated this code path here. Also, I 
further cleaned the metrics computation code to be cleaner.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to