nicoloboschi commented on pull request #14097:
URL: https://github.com/apache/pulsar/pull/14097#issuecomment-1028312716


   The consequence of the issue is on the Consumer side. The problem (and 
actually the fix) resides on the broker side.
   
   If you have a Pulsar 2.8.x cluster with `transactionCoordinatorEnabled=true` 
and a client (2.8.x or 2.9.x) uses `enableTransaction=false`, everything works 
fine. The client is able to produce and consume (even without creating a 
transaction).
   
   If you have a Pulsar 2.9.x cluster with `transactionCoordinatorEnabled=true` 
and a client (2.8.x or 2.9.x) uses `enableTransaction=false`, the producer will 
produce the message correctly but, on the broker side, for the topic used by 
the producer, the state will remain to `Initialized` since the procedure to 
change the state to `Ready` it's performed only if `enableTransaction=true` 
(the PR solves this problem) [1]. Additionally the `TopicTransactionBuffer` 
instance will never update the `maxReadPosition` [2] and then the cursor will 
read from the ledgers with maxReadPosition=-1 (that means it will never get 
entries) [3]. The dispatcher will endless read from BookKeeper without never 
find entries. (the continuously polling from BookKeeper is another severe 
consequence). 
   
   [1] 
https://github.com/apache/pulsar/blob/20af454af44d979fc43c77de3b8d0e0114411db7/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java#L176-L195
   
   [2] 
https://github.com/apache/pulsar/blob/186cd412022b3f95ce7de04ea67dc17415bb64d0/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java#L449-L463
   This method will called after the ledger write and, since the state is 
equals to Initialized, the `maxReadPosition` won't be updated.
   
   [3] 
https://github.com/apache/pulsar/blob/497e9114838c758604b69f283df6662831b88412/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java#L354-L355
   
https://github.com/apache/pulsar/blob/186cd412022b3f95ce7de04ea67dc17415bb64d0/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/TopicTransactionBuffer.java#L466-L472
   
   
   
   


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