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



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java
##########
@@ -219,11 +224,16 @@ protected void sendMessagesToConsumers(ReadType readType, 
List<Entry> entries) {
                         sendMessageInfo.getTotalMessages(),
                         sendMessageInfo.getTotalBytes(), 
sendMessageInfo.getTotalChunkedMessages(),
                         getRedeliveryTracker()).addListener(future -> {
-                    if (future.isDone() && keyNumbers.decrementAndGet() == 0) {
-                        readMoreEntries();
-                    }
-                });
-
+                            if (future.isSuccess()) {
+                                Entry entry = 
entriesWithSameKey.get(entriesWithSameKey.size() - 1);
+                                Integer hashCode =
+                                        
selector.generateKeyHash(peekStickyKey(entry.getDataBuffer()));
+                                currentSendPositionPerKeyMap.put(hashCode, 
entry.getPosition());

Review comment:
       Also, this would break if there is a hash collision. 

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java
##########
@@ -219,11 +224,16 @@ protected void sendMessagesToConsumers(ReadType readType, 
List<Entry> entries) {
                         sendMessageInfo.getTotalMessages(),
                         sendMessageInfo.getTotalBytes(), 
sendMessageInfo.getTotalChunkedMessages(),
                         getRedeliveryTracker()).addListener(future -> {
-                    if (future.isDone() && keyNumbers.decrementAndGet() == 0) {
-                        readMoreEntries();
-                    }
-                });
-
+                            if (future.isSuccess()) {
+                                Entry entry = 
entriesWithSameKey.get(entriesWithSameKey.size() - 1);
+                                Integer hashCode =
+                                        
selector.generateKeyHash(peekStickyKey(entry.getDataBuffer()));
+                                currentSendPositionPerKeyMap.put(hashCode, 
entry.getPosition());

Review comment:
       This can potentially be storing a very large amount of `PositionImpl` 
instances, that will get tenured and will put pressure on the GC.




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


Reply via email to