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/20 15:06:12 UTC

[GitHub] [pulsar] MarvinCai commented on a change in pull request #10240: [consumer] fix order guarantee for MultiTopicsConsumerImpl

MarvinCai commented on a change in pull request #10240:
URL: https://github.com/apache/pulsar/pull/10240#discussion_r616774270



##########
File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
##########
@@ -1050,15 +1053,23 @@ void messageReceived(MessageIdData messageId, int redeliveryCount, List<Long> ac
 
             // Enqueue the message so that it can be retrieved when application calls receive()
             // if the conf.getReceiverQueueSize() is 0 then discard message if no one is waiting for it.
-            // if asyncReceive is waiting then notify callback without adding to incomingMessages queue
             if (deadLetterPolicy != null && possibleSendToDeadLetterTopicMessages != null &&
                     redeliveryCount >= deadLetterPolicy.getMaxRedeliverCount()) {
                 possibleSendToDeadLetterTopicMessages.put((MessageIdImpl)message.getMessageId(),
                         Collections.singletonList(message));
             }
-            if (peekPendingReceive() != null) {
-                notifyPendingReceivedCallback(message, null);
-            } else if (enqueueMessageAndCheckBatchReceive(message) && hasPendingBatchReceive()) {
+            CompletableFuture<Message<T>> pendingReceiveFuture;
+            lock.writeLock().lock();

Review comment:
       I really don't think we should lock here, this method will be invoked by netty-io thread, we shouldn't ever block this thread.




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