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/10/31 03:37:18 UTC

[GitHub] [pulsar] codelipenghui commented on a diff in pull request #18156: Retry producing on next partition if possible when a partit…

codelipenghui commented on code in PR #18156:
URL: https://github.com/apache/pulsar/pull/18156#discussion_r1009004554


##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerBuilder.java:
##########
@@ -608,4 +608,15 @@
      * @return the producer builder instance
      */
     ProducerBuilder<T> enableLazyStartPartitionedProducers(boolean lazyStartPartitionedProducers);
+
+    /**
+     * This config will ensure that If possible PartitionedProducer would attempt to produce message on
+     * another available partitions, If currently picked partition is not available for some reason.
+     * Next available partition will be chosen by the same routing policy as client is configured with.
+     * @param maxRetryOtherPartition
+     *            How many partitions should be tried before bailing out
+     * @return the producer builder instance
+     */
+    ProducerBuilder<T> maxRetryOtherPartitions(int maxRetryOtherPartition);

Review Comment:
   I agree with @merlimat 
   
   The issue is the RoundRobin router. Not for all the routers.
   IMO, it looks like we need a new router based on the available pending messages.
   
   e.g. we have 3 partitions
   
   0 -> 1000 available pending messages
   1 -> 1000 available pending messages
   2 -> 1000 available pending messages
   
   After sending 3 messages.
   
   0 -> 999 available pending messages
   1 -> 999 available pending messages
   2 -> 999 available pending messages
   
   After receiving the send receipt 
   
   0 -> 1000 available pending messages
   1 -> 999 available pending messages (partition-1 is unavailable)
   2 -> 1000 available pending messages
   
   The subsequent new messages should choose partition-0 and partition-1 and so on.



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