[Zodb-checkins] CVS: Zope2/lib/python/ZODB - HistoryStorage.py:1.3

barry@digicool.com barry@digicool.com
Fri, 15 Jun 2001 14:21:29 -0400 (EDT)


Update of /cvs-repository/Zope2/lib/python/ZODB/tests
In directory korak.digicool.com:/tmp/cvs-serv25997

Modified Files:
	HistoryStorage.py 
Log Message:
checkHistoryAfterVersionCommit(), checkHistoryAfterVersionAbort():
After consultation with Jim, we agreed that Full's behavior vis object
serial numbers after a version commit/abort are correct.  The new
revision should get the serial number of the transaction that did the
commit/abort.

FileStorage is actually broken here; the new revision gets the same
serial number as the last in-version revision.  However, the way the
tests are written, it works for either storage, so I'm just updating
some comments to explain the situation.

Note: Jim also explained that history()'s "version" argument should be
ignored.  Doesn't make much difference to these tests though.



--- Updated File HistoryStorage.py in package Zope2/lib/python/ZODB --
--- HistoryStorage.py	2001/06/14 20:35:43	1.2
+++ HistoryStorage.py	2001/06/15 18:21:29	1.3
@@ -94,10 +94,16 @@
         oids = self._storage.commitVersion(version, '', self._transaction)
         self._storage.tpc_vote(self._transaction)
         self._storage.tpc_finish(self._transaction)
-        # It is not guaranteed that the revision id (a.k.a. serial number) for
-        # the version-committed object is the same as the last in-version
-        # modification.  We need to suck that out of the API a different way,
-        # just to be sure.
+        # After consultation with Jim, we agreed that the semantics of
+        # revision id's after a version commit is that the committed object
+        # gets a new serial number (a.k.a. revision id).  Note that
+        # FileStorage is broken here; the serial number in the post-commit
+        # non-version revision will be the same as the serial number of the
+        # previous in-version revision.
+        #
+        # BAW: Using load() is the only way to get the serial number of the
+        # current revision of the object.  But at least this works for both
+        # broken and working storages.
         ign, revid7 = self._storage.load(oid, '')
         # Now, try to get the six historical revisions (first three are in
         # 'test-version', followed by the non-version revisions).
@@ -137,10 +143,16 @@
         oids = self._storage.abortVersion(version, self._transaction)
         self._storage.tpc_vote(self._transaction)
         self._storage.tpc_finish(self._transaction)
-        # It is not guaranteed that the revision id (a.k.a. serial number) for
-        # the version-committed object is the same as the last in-version
-        # modification.  We need to suck that out of the API a different way,
-        # just to be sure.
+        # After consultation with Jim, we agreed that the semantics of
+        # revision id's after a version commit is that the committed object
+        # gets a new serial number (a.k.a. revision id).  Note that
+        # FileStorage is broken here; the serial number in the post-commit
+        # non-version revision will be the same as the serial number of the
+        # previous in-version revision.
+        #
+        # BAW: Using load() is the only way to get the serial number of the
+        # current revision of the object.  But at least this works for both
+        # broken and working storages.
         ign, revid7 = self._storage.load(oid, '')
         # Now, try to get the six historical revisions (first three are in
         # 'test-version', followed by the non-version revisions).