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,13 +153,17 @@ class StorageTestBase(unittest.TestCase): ...@@ -153,13 +153,17 @@ 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
self._storage.tpc_begin(t) try:
# Store an object self._storage.tpc_begin(t)
r1 = self._storage.store(oid, revid, data, version, t) # Store an object
# Finish the transaction r1 = self._storage.store(oid, revid, data, version, t)
r2 = self._storage.tpc_vote(t) # Finish the transaction
revid = handle_serials(oid, r1, r2) r2 = self._storage.tpc_vote(t)
self._storage.tpc_finish(t) revid = handle_serials(oid, r1, r2)
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