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


   > 2. Return an error to the client, "The current producer is creating, 
please close the old one first!"
   
   This is already the current behavior. See: 
https://github.com/apache/pulsar/blob/f48b53d33ee1be9b8436593119dfbce38be2c81f/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/ServerCnx.java#L1175-L1201.
   
   I agree that sending a failure is the right design, since the client is not 
following the protocol spec (it shouldn't try to create the same producer 
twice). Although, technically, if the producer is already created, we just 
respond that it was created successfully. I am not sure that I like this 
design, but that is a different discussion.
   
   I described in detail why it is problematic if the client does not send the 
`CloseProducer` command before trying to create a new producer here 
(https://lists.apache.org/thread/x7886r5v1dtg4c4nbptdfn97ryw097wl):
   
   > Specifically, if the client fails to send a `CloseProducer` command,
   it ends up getting into a sequence of retries where each new
   `Producer` command receives an immediate `ErrorResponse` because the
   `ServerCnx` already has a pending producer. By sending a
   `CloseProducer` command, the client gives the broker permission to
   stop keeping track of the original create producer request. It also
   means that if the topic eventually loads, the broker will respond to
   the right request id with a `ProducerSuccessResponse` command.
   
   This is another reason why the broker shouldn't respond if the producer 
future is already completed: it gets completed when the client sends a 
`CloseProducer` command.


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