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 2022/06/08 15:37:57 UTC

[GitHub] [pulsar] coderzc commented on a diff in pull request #15963: [fix][broker] KeyShared stickyHashRange subscription: Fix not be able to receive a message when send a can‘t match consumer message

coderzc commented on code in PR #15963:
URL: https://github.com/apache/pulsar/pull/15963#discussion_r892543367


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentStickyKeyDispatcherMultipleConsumers.java:
##########
@@ -215,13 +219,18 @@ protected void sendMessagesToConsumers(ReadType readType, List<Entry> entries) {
         final Map<Consumer, Set<Integer>> consumerStickyKeyHashesMap = new HashMap<>();
 
         for (Entry entry : entries) {
-            int stickyKeyHash = getStickyKeyHash(entry);
+            final int stickyKeyHash = getStickyKeyHash(entry);
+            final long ledgerId = entry.getLedgerId();
+            final long entryId = entry.getEntryId();
             Consumer c = selector.select(stickyKeyHash);
             if (c != null) {
                 groupedEntries.computeIfAbsent(c, k -> new ArrayList<>()).add(entry);
                 consumerStickyKeyHashesMap.computeIfAbsent(c, k -> new HashSet<>()).add(stickyKeyHash);
             } else {
-                addMessageToReplay(entry.getLedgerId(), entry.getEntryId(), stickyKeyHash);
+                topic.getBrokerService().executor().schedule(() -> {

Review Comment:
   > Is there any difference between scheduled or directly executing the method `addMessageToReplay`?
   > 
   > Do we need to reset the backoff param?
   
   If not scheduled execution, the failed message will be redelivery constantly, which will lead to other messages having no chance to be sent.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org