merlimat commented on issue #13965:
URL: https://github.com/apache/pulsar/issues/13965#issuecomment-1023525176


   @BewareMyPower 
   
   > I've tried both solutions above in C++ client and it works well. But I'm 
confused about why it works, could you explain a little more? @merlimat
   
   While it was clear for the repro code that you share, I couldn't find the 
problem in the C++ test (since it was acking the messages). 
   
   
   > However, the testKeyBasedBatching failed sometimes. In this test, a 
producer is created to send messages with interleaved keys and key based 
batching. i.e. send: ABABABAB......
   
   The random behavior is due to the auto-generated consumer names. The 
selection of consumers is done like: 
    * Take the consumer name and place 100 points in the hash ring
    * The points are selected like hash(consumerName + "0"), hash(consumerName 
+ "1"), hash(consumerName + "2") ... 
   
   For 2 given message keys, you're not guaranteed that they will be assigned 
to 2 different consumers, although statistically, the keys will be evenly 
distributed across consumers.
   
   To make the test deterministic, you can set the consumer names (different) 
on the 2 consumers.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to