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/09/27 22:18:47 UTC

[GitHub] [pulsar] michaeljmarshall commented on pull request #12195: When the producer or client is normally closed, data will be lost

michaeljmarshall commented on pull request #12195:
URL: https://github.com/apache/pulsar/pull/12195#issuecomment-928356796


   https://github.com/apache/pulsar/blob/04604724dd89a4c8ff40b922e80c7045fedf112d/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Producer.java#L178-L186
   
   Given the Javadoc for `closeAsync`, I would expect the implementation to include a flush of all pending messages. Perhaps there is ambiguity for what constitutes a "pending write request"? I think a "pending write request" is any write request the producer has already accepted. This also aligns with the fact that the producer will not accept any more write requests.
   
   > First, we cannot assume pending messages are sent quickly. If your buffer memory is large enough, it might take long time to close. Assuming you have 100000 pending messages and in the timeout, only 20000 messages are persisted. What will you do now?
   
   If we add a timeout to the `closeAsync` logic, I think it is reasonable to fail all pending work that is not completed before the deadline and clean up all resources. It is up to the implementation to decide how long to wait for messages to deliver, and we already let users configure this via the `sendTimeoutMs` in the producer's config. This config is already used to fail messages that haven't delivered after some period of time.


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