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):
t.user = user
if description is not None:
t.description = description
self._storage.tpc_begin(t)
# Store an object
r1 = self._storage.store(oid, revid, data, version, t)
# Finish the transaction
r2 = self._storage.tpc_vote(t)
revid = handle_serials(oid, r1, r2)
self._storage.tpc_finish(t)
try:
self._storage.tpc_begin(t)
# Store an object
r1 = self._storage.store(oid, revid, data, version, t)
# Finish the transaction
r2 = self._storage.tpc_vote(t)
revid = handle_serials(oid, r1, r2)
self._storage.tpc_finish(t)
except:
self._storage.tpc_abort(t)
raise
return revid
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