You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sentry.apache.org by "Sergio Peña (JIRA)" <ji...@apache.org> on 2017/07/10 15:10:00 UTC
[jira] [Updated] (SENTRY-1491) Sentry transactions are not rolled
back immediately when commit fails
[ https://issues.apache.org/jira/browse/SENTRY-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergio Peña updated SENTRY-1491:
--------------------------------
Fix Version/s: sentry-ha-redesign
> Sentry transactions are not rolled back immediately when commit fails
> ---------------------------------------------------------------------
>
> Key: SENTRY-1491
> URL: https://issues.apache.org/jira/browse/SENTRY-1491
> Project: Sentry
> Issue Type: Bug
> Components: Sentry
> Affects Versions: 1.7.0, sentry-ha-redesign
> Reporter: Alexander Kolbasov
> Assignee: Alexander Kolbasov
> Fix For: sentry-ha-redesign
>
>
> Here is the code for commitTransaction:
> {code}
> public void commitTransaction(PersistenceManager pm) {
> Transaction currentTransaction = pm.currentTransaction();
> try {
> Preconditions.checkState(currentTransaction.isActive(), "Transaction is not active");
> currentTransaction.commit();
> } finally {
> pm.close();
> }
> }
> {code}
> so it does pm.close() in the finally clause, so it always closes pm.
> Now everyone else does something like
> {code}
> commitTransaction(pm);
> rollbackTransaction = false;
> return roles;
> } finally {
> if (rollbackTransaction) {
> rollbackTransaction(pm);
> }
> }
> {code}
> which means that pm is closed by the time we call rollbackTransaction() and we never rollback when commit fails. As a result rollback is deferred till connection close (which may be some time due to connection pooling) and we are potentially holding various locks for longer than needed.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)