Skip to content

Conversation

@3noch
Copy link
Contributor

@3noch 3noch commented May 9, 2020

Based on #34

3noch added 2 commits October 11, 2019 17:51
Transactions that enter an error state must be aborted manually by
issuing a "ROLLBACK". However, if the transaction error happened during
a "COMMIT" then the rollback happens automatically. Issuing a "ROLLBACK"
at this point causes PostgreSQL to issue a "WARNING: There is no
transaction in progress". This warning can have much worse causes (e.g.
you "COMMIT" but never began a transaction). This change makes the
transaction retrying logic never cause PostgreSQL to issue this warning
making it a more useful warning for detecting real bugs.
mask $ \restore ->
retryLoop $ E.try $ do
a <- restore act
a <- restore act `E.onException` rollback_ conn
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: Why do we want to use rollback_ here? I don't know why it would be a good idea to ignore exceptions during the rollback.

Also note rollback_ is not exported, but I'm suspicious that it's a good idea in the first place.

@phadej
Copy link
Collaborator

phadej commented Nov 15, 2020

Merged as part of #54

@phadej phadej closed this Nov 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants