Commit abfa73a9 authored by Barry Warsaw's avatar Barry Warsaw

_doabort(): Instead of try/except, only zap the currentVersions entry

when vid <> ZERO.  Also, rename a local variable.

_dotxnundo(): Fix insertion of information into the currentVersions
table.  Key should be vid and value should be revid.

_collect_objs(): It's possible the vid,revid pair has already been
deleted so catch DBNotFoundErrors.

These seem to fix the last of the BDBFull test failures.
parent 439b7d37
......@@ -14,7 +14,7 @@
"""Berkeley storage with full undo and versioning support.
$Revision: 1.68 $
$Revision: 1.69 $
"""
import time
......@@ -347,11 +347,8 @@ class BDBFullStorage(BerkeleyBase, ConflictResolvingStorage):
else:
cr.delete()
# Now we have to clean up the currentVersions table
try:
if vid <> ZERO:
cv.set_both(vid, revid)
except db.DBNotFoundError:
pass
else:
cv.delete()
finally:
# There's a small window of opportunity for leaking cursors here,
......@@ -362,17 +359,17 @@ class BDBFullStorage(BerkeleyBase, ConflictResolvingStorage):
if cv: cv.close()
if cr: cr.close()
# Now clean up the vids and versions tables
cv = self._pvids.cursor(txn=txn)
cpv = self._pvids.cursor(txn=txn)
try:
rec = cv.first()
rec = cpv.first()
while rec:
vid = rec[0]
rec = cv.next()
rec = cpv.next()
version = self._versions[vid]
self._versions.delete(vid, txn=txn)
self._vids.delete(version, txn=txn)
finally:
cv.close()
cpv.close()
# Now clean up the tid indexed table, and the temporary log tables
self._txnMetadata.delete(tid, txn=txn)
self._oids.truncate(txn)
......@@ -1192,7 +1189,7 @@ class BDBFullStorage(BerkeleyBase, ConflictResolvingStorage):
self._prevrevids.put(oid, prevrevid, txn=txn)
self._txnoids.put(newserial, oid, txn=txn)
if vid <> ZERO:
self._currentVersions.put(oid, vid, txn=txn)
self._currentVersions.put(vid, revid, txn=txn)
self._oids.put(oid, PRESENT, txn=txn)
rtnoids[oid] = 1
# Add this object revision to the autopack table
......@@ -1579,8 +1576,12 @@ class BDBFullStorage(BerkeleyBase, ConflictResolvingStorage):
if vid <> ZERO:
cv = self._currentVersions.cursor(txn=txn)
try:
cv.set_both(vid, revid)
cv.delete()
try:
cv.set_both(vid, revid)
except db.DBNotFoundError:
pass
else:
cv.delete()
finally:
cv.close()
# BAW: maybe we want to refcount vids and versions table
......
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