nicoloboschi opened a new pull request #14097: URL: https://github.com/apache/pulsar/pull/14097
### Motivation Consumer is not able to consume messages if you don't explicitly enable the transactions on the client side (even if you don't want to use them) using `enableTransaction`flag. https://github.com/apache/pulsar/blob/3b8250d755a896c6f8837d59db74e56c7059caad/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ClientBuilder.java#L539 A common scenario is that the broker admins enable the transactions on the broker side (`transactionCoordinatorEnabled=true`). Currently, the client must call `enableTransaction(true)` in ClientBuilder in order to get the consumers work. **This is a breaking change between Pulsar 2.8.x and 2.9.0+** The PR that introduced this behaviour is https://github.com/apache/pulsar/pull/12219. When the Server receive the Producer command, if enableTransaction is false, it will not update the `TopicTransactionBufferState` state and it last in `Initializing` state forever. https://github.com/apache/pulsar/blob/97f0030ea4651c01227072b3a7522dc9ff198623/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java#L175-L203 Given that: - Transactions are available for all the topic if enabled on the broker side (there's no fine grained flag for topic) - Another client could connect with a different flag configuration to the same topic - The `TopicTransactionBuffer` and the `TopicTransactionBufferState` is a single instance per topic sending the flag to the broker doesn't make sense and the broker should't treat the topic differently. It remains important into the client for additional checks and for reducing resources usage (in case transactions are disabled). See https://github.com/apache/pulsar/blob/6e353b7584bb95cba7fd367bc7e93177683ece02/pulsar-client/src/main/java/org/apache/pulsar/client/impl/PulsarClientImpl.java#L201-L209 ### Modifications * Added a reproducer * Removed the check into the broker. Now the flag is useless. I'm not sure if it's a good idea to remove it from the procotol (CommandProducer), for now I left it there. ### Documentation - [x] `no-need-doc` -- 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]
