Closed dvachaiev closed 1 month ago
Well, you owe me an hour back, but I suppose I owe you that time back as well because my own example is wrong. The code block above is failing because doCommit && e.Err() == nil
short circuits when doCommit
is false, meaning e.Err() == nil
is never evaluated, meaning the AbortingFirstErrPromise never actually waits for records to be produced, meaning the transaction is actually ended before a single record is produced. The abort records actually are produced in a new transaction -- the one that actually will commit.
I spent far too long trying to figure out why this worked when I moved e.Err()
out and made the code:
perr := e.Err()
commit := kgo.TransactionEndTry(doCommit && perr == nil)
I'll fixup the example.
Calling
Client.EndTransaction(ctx, kgo.TryAbort)
doesn't abort transaction on the broker and records from it can be consumed withread_committed
isolation level after next committed transaction:Messages with
abort
in value shouldn't be consumed and there is no control record between aborted and committed records.To reproduce I used slightly modified eos script: