Commit a858080a authored by Jeremy Hylton's avatar Jeremy Hylton

Guarantee that _dostore() does not leave a transaction in progress.

Put the tpc_begin() -> tpc_finish() in a try/except.  If an error
occurs, abort the current transaction and re-raise the error.

It appears that some storages (well, only Standby Storage) has trouble
shutting down if a transaction is in progress.
parent 8d5938be
...@@ -153,6 +153,7 @@ class StorageTestBase(unittest.TestCase): ...@@ -153,6 +153,7 @@ class StorageTestBase(unittest.TestCase):
t.user = user t.user = user
if description is not None: if description is not None:
t.description = description t.description = description
try:
self._storage.tpc_begin(t) self._storage.tpc_begin(t)
# Store an object # Store an object
r1 = self._storage.store(oid, revid, data, version, t) r1 = self._storage.store(oid, revid, data, version, t)
...@@ -160,6 +161,9 @@ class StorageTestBase(unittest.TestCase): ...@@ -160,6 +161,9 @@ class StorageTestBase(unittest.TestCase):
r2 = self._storage.tpc_vote(t) r2 = self._storage.tpc_vote(t)
revid = handle_serials(oid, r1, r2) revid = handle_serials(oid, r1, r2)
self._storage.tpc_finish(t) self._storage.tpc_finish(t)
except:
self._storage.tpc_abort(t)
raise
return revid return revid
def _dostoreNP(self, oid=None, revid=None, data=None, version=None, def _dostoreNP(self, oid=None, revid=None, data=None, version=None,
......
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