summaryrefslogtreecommitdiff
path: root/django/db/transaction.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-07-28 14:30:41 +0200
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-07-28 14:30:41 +0200
commit729e4ae4f0730585ac4640e7fa3aa06374677ff2 (patch)
treeed724443e2dfc55150a518959ef44c299b6a9e71 /django/db/transaction.py
parent53a61d82b38b7c39fa8ec4bd3047014694e96f60 (diff)
Fixed #23074 -- Avoided leaking savepoints in atomic.
Thanks Chow Loong Jin for the report and the initial patch.
Diffstat (limited to 'django/db/transaction.py')
-rw-r--r--django/db/transaction.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/django/db/transaction.py b/django/db/transaction.py
index 786bc53581..4fb58d6dd8 100644
--- a/django/db/transaction.py
+++ b/django/db/transaction.py
@@ -219,6 +219,9 @@ class Atomic(object):
except DatabaseError:
try:
connection.savepoint_rollback(sid)
+ # The savepoint won't be reused. Release it to
+ # minimize overhead for the database server.
+ connection.savepoint_commit(sid)
except Error:
# If rolling back to a savepoint fails, mark for
# rollback at a higher level and avoid shadowing
@@ -249,6 +252,9 @@ class Atomic(object):
else:
try:
connection.savepoint_rollback(sid)
+ # The savepoint won't be reused. Release it to
+ # minimize overhead for the database server.
+ connection.savepoint_commit(sid)
except Error:
# If rolling back to a savepoint fails, mark for
# rollback at a higher level and avoid shadowing