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 2021/04/27 02:43:05 UTC

[GitHub] [pulsar] baomingyu commented on a change in pull request #10285: fix issue 10284 Occasional consumer stucked when restart consumer whit key_shared subscription type

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



##########
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:
       Same hash will use same consumer,so there is not problem when there is a hash collision, this map only record one position to one hash key,




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