immudb icon indicating copy to clipboard operation
immudb copied to clipboard

Rollback after failed exec

Open ldej opened this issue 2 years ago • 3 comments

Performing a Rollback after a failed SQLExec results in a no transaction found error

ldej avatar Jul 12 '22 09:07 ldej

Coverage Status

Coverage decreased (-0.006%) to 89.827% when pulling 6e9d7e1e706cf6231e911693919034864ec780ce on fix/transaction-rollback into aea8acc16f2e53abf5357d0fe94877122b6ba8a3 on master.

coveralls avatar Jul 12 '22 10:07 coveralls

I solved this by only closing (Cancel) a transaction if it has been created within execPreparedStmts. I looked at how this was solved in QueryPreparedStmt.

The transaction also gets returned, otherwise tx.sqlTx would be set to nil in transaction.SQLExec (pkg/server/sessions/internal/transactions/transactions.go)

ldej avatar Jul 12 '22 10:07 ldej