Skip to content

Conversation

jwilger
Copy link
Contributor

@jwilger jwilger commented Sep 2, 2020

The use of generic RuntimeError exceptions coming from the TransactionManager requires brittle error-handling in dependant code, so I've changed most of the raise statements in the TransactionManager to use the Kafka::InvalidTxnStateError exception.

Additionally, there may be cases where dependant code starts a transaction using the producer's #transaction block syntax and then an exception is raised within that block before the transaction manager actually opens up a transaction. In such cases, prior to this change, the real exception is obfuscated, because the transaction manager would raise an exception
about not being in a valid transactional state.

With this change, attempting to abort a transaction that has not actually been opened will no longer result in an exception. Instead it will log a warning message and leave the transaction manager in its ready state.

The use of generic RuntimeError exceptions requires brittle error-handling in dependant code.
There may be cases where dependant code starts a transaction using the producer's `#transaction` block syntax and then an exception is raised within that block *before* the transaction manager actually opens up a transaction. In such cases, prior to this change, the real exception is obfuscated, because the transaction manager would raise an exception about not being in a valid transactional state. With this change, attempting to abort a transaction that has not actually been opened will no longer result in an exception. Instead it will log a warning message and leave the transaction manager in its ready state.
@dasch dasch merged commit f248f59 into zendesk:master Sep 15, 2020
@dasch
Copy link
Contributor

dasch commented Sep 15, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants