TransactionAbortedError and cleanup


I forgot what the deal is with TransactionAbortedError; when the (KV) client receives this error, does it need to do cleanup by sending an EndTransactionRequest with commit == false, or is there nothing to cleanup? In other words, does the Transaction proto that the client get back have the same ID (and an incremented epoch) or newly generated one? I’m guessing it’s the same ID, so as to keep the old intents in place, but then I’m not sure what the difference is between this aborted error, and any other retriable errors? Do other retriable errors no increment the epoch?

Also, I’m having a bit of trouble finding the code that does the relevant manipulation of the Transaction proto in case of this error. Does it happen client-side, in TxnCoordSender, or server side by attaching an updated txn proto to a pErr?


I believe I’ve answered my question. For posterity, the client.Txn object itself handles the TransactionAbortedError and re-initializes its own proto to a pretty empty one:

And then calling Rollback() on such a Txn is a no-op because, since there’s been no writer, the batch generated by sendEndTxnReq is empty.