Commit 1f8fa3b1 authored by Jim Fulton's avatar Jim Fulton

Bug fixed:

* Fixed a bug that caused extra commit calls to be made on data
  managers under certain special circumstances.

https://mail.zope.org/pipermail/zodb-dev/2010-May/013329.html
parent e3a8cd9d
Changes
=======
1.0.2 (unreleased)
------------------
1.1.0 (1010-05-??)
Bugs fixed:
=======
- TBD
- Fixed a bug that caused extra commit calls to be made on data
managers under certain special circumstances.
https://mail.zope.org/pipermail/zodb-dev/2010-May/013329.html
1.0.1 (2010-05-07)
------------------
......@@ -15,25 +19,24 @@ Changes
- Updated tests to remove use of deprecated ``zope.testing.doctest``.
1.0.0 (2009-07-24)
------------------
* Fix test that incorrectly relied on the order of a list that was generated
- Fix test that incorrectly relied on the order of a list that was generated
from a dict.
* Remove crufty DEPENDENCIES.cfg left over from zpkg.
- Remove crufty DEPENDENCIES.cfg left over from zpkg.
1.0a1 (2007-12-18)
------------------
* Initial release, branched from ZODB trunk on 2007-11-08 (aka
= Initial release, branched from ZODB trunk on 2007-11-08 (aka
"3.9.0dev").
* Remove (deprecated) support for beforeCommitHook alias to
- Remove (deprecated) support for beforeCommitHook alias to
addBeforeCommitHook.
* Add weakset tests.
- Add weakset tests.
* Remove unit tests that depend on ZODB.tests.utils from
- Remove unit tests that depend on ZODB.tests.utils from
test_transaction (these are actually integration tests).
......@@ -242,6 +242,13 @@ class Transaction(object):
transaction_savepoint._savepoints.append(
datamanager_savepoint)
def _unjoin(self, resource):
# Leave a transaction because a savepoint was rolled back on a resource
# that joined later.
# Don't use remove. We don't want to assume anything about __eq__.
self._resources = [r for r in self._resources if r is not resource]
def savepoint(self, optimistic=False):
if self.status is Status.COMMITFAILED:
self._prior_operation_failed() # doesn't return, it raises
......@@ -669,6 +676,7 @@ class AbortSavepoint:
def rollback(self):
self.datamanager.abort(self.transaction)
self.transaction._unjoin(self.datamanager)
class NoRollbackSavepoint:
......
......@@ -12,8 +12,6 @@
#
##############################################################################
"""Tests of savepoint feature
$Id$
"""
import unittest
import doctest
......@@ -33,7 +31,7 @@ savepoint:
>>> sp1 = transaction.savepoint()
>>> dm['job'] = 'geek'
>>> sp2 = transaction.savepoint()
>>> dm['salary'] = 'fun'
>>> dm['salary'] = 'fun'
>>> dm2 = savepointsample.SampleSavepointDataManager()
>>> dm2['name'] = 'sally'
......@@ -59,6 +57,27 @@ savepoint:
"""
def test_commit_after_rollback_for_dm_that_joins_after_savepoint():
"""
There was a problem handling data managers that joined after a
savepoint. If the savepoint was rolled back and then changes made,
the dm would end up being joined twice, leading to extra tpc calls and pain.
>>> import transaction
>>> sp = transaction.savepoint()
>>> from transaction.tests import savepointsample
>>> dm = savepointsample.SampleSavepointDataManager()
>>> dm['name'] = 'bob'
>>> sp.rollback()
>>> dm['name'] = 'Bob'
>>> transaction.commit()
>>> dm['name']
'Bob'
"""
def test_suite():
return unittest.TestSuite((
doctest.DocFileSuite('savepoint.txt'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment