lhotari commented on code in PR #23904:
URL: https://github.com/apache/pulsar/pull/23904#discussion_r1936783776


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:
##########
@@ -439,12 +439,17 @@ private Map<Consumer, List<Entry>> 
filterAndGroupEntriesForDispatching(List<Entr
                             permitsForConsumer.computeIfAbsent(consumer,
                                     k -> new 
MutableInt(getAvailablePermits(k)));
                     // a consumer was found for the sticky key hash and the 
entry can be dispatched
-                    if (permits.intValue() > 0
-                            && canDispatchEntry(consumer, entry, readType, 
stickyKeyHash, blockedByHash)) {
-                        // decrement the permits for the consumer
-                        permits.decrement();
-                        // allow the entry to be dispatched
-                        dispatchEntry = true;
+                    if (permits.intValue() > 0) {
+                        boolean canDispatchEntry = canDispatchEntry(consumer, 
entry, readType, stickyKeyHash);
+                        if (!canDispatchEntry) {
+                            if(blockedByHash != null){
+                                blockedByHash.setTrue();
+                            }
+                            // decrement the permits for the consumer
+                            permits.decrement();
+                            // allow the entry to be dispatched
+                            dispatchEntry = true;
+                        }

Review Comment:
   > Could you explain it in detail? @lhotari
   
   Here's Deepseek's detailed explanation based on 
https://github.com/apache/pulsar/pull/23904.patch 
   <img width="903" alt="image" 
src="https://github.com/user-attachments/assets/94d7bd69-7293-403b-bd6e-1c3b5fb1e005";
 />
   



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