jiangmocc opened a new issue, #1498: URL: https://github.com/apache/pulsar-client-go/issues/1498
## Bug description Transactional publishes currently put the transaction id on `CommandSend`, but the serialized `MessageMetadata` does not carry `txnid_most_bits` and `txnid_least_bits` for producer-created messages. Because the broker-side transaction buffer uses the transaction id in message metadata to identify transactional entries, messages published inside a transaction can be treated as normal visible messages. In particular, after aborting the transaction, those messages may still be delivered to consumers. ## Expected behavior Messages published with `ProducerMessage.Transaction` should include the transaction id in `MessageMetadata` as well as in `CommandSend`, so aborted transaction messages remain invisible and are removed by the transaction buffer. ## Actual behavior The producer resolves the transaction id for send commands, but does not copy it into `MessageMetadata` for single-message sends or batch metadata. ## Suggested fix When a send request has a transaction: - set `MessageMetadata.TxnidMostBits` and `MessageMetadata.TxnidLeastBits` for single-message sends - set the same fields on batch-level `MessageMetadata` when the first message in a batch is transactional - clear the batch transaction fields after flushing so a later non-transactional batch cannot inherit them -- 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]
