congbobo184 edited a comment on pull request #14097: URL: https://github.com/apache/pulsar/pull/14097#issuecomment-1032310651
@nicoloboschi hi, I don't think we should return the Exception from broker to client when producer connect. In order to don't let disable transaction producer connect broker wait `transactionBuffer` recover. Maybe we can create a future filed in `TopicTransactionBuffer` like `transactionBufferFuture`. When `TopicTransactionBuffer` check the snapshot exist or not completely, we can complete this future then the producer can connect. If has snapshot, we change maxReadPosition when `TopicTransactionBuffer` recover completely. If don't have snapshot, we also can change maxReadPosition. In this way, we don't need to return exception to client and client don't need to reconnect. If keep sending messages, we also can change `MaxReadPosition`. If change this logic to wait check snapshot exist or not, every producer enable txn or not connect broker will check snapshot exist or not, Is it really necessary? I think before take the first snapshot, we can add a flag to `managedLedger` properties, if the flag is true, we should check the snapshot exist or not. if the flag is false, we don't need to check the snapshot exist, change the `TopicTransactionBuffer` state to NoSnapshot directly. In this way, If this topic has sent transaction message or want to end transaction message before, we should check the snapshot exist or not. If this topic has never thought of sending transaction messages, we also change the state to NoSnapshot directly and don't need to wait check snapshot exist or not. what do you think of? -- 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]
