[ZODB-Dev] Test Failure

Barry A. Warsaw barry@zope.com
Fri, 24 May 2002 14:57:02 -0400


>>>>> "TP" == Tim Peters <tim@zope.com> writes:

    TP> BTW, if the packtime business makes sense to you (beats me
    TP> ...), a robust way to fix it is to get rid of the
    TP> time.sleep(1) and do this instead:

    |         start = packtime = time.time()
    |         while packtime <= start:
    |             packtime = time.time()

    TP> That should zoom on Linux, and spin for about 0.055/2 ~= 0.028
    TP> seconds (on average) on Windows.

I'm always confused by the exact official semantics of the timestamp
argument to pack(), but I believe it is this:

    all non-current revisions written prior to the timestamp are
    removed[1]

By that rule, if the timestamp for revid1 is equal to packtime because
Windows clock hasn't ticked over, then you would indeed not pack away
the first revision, leaving 3 items in your second undoInfo() instead
of the expected 2.

So it seems to me that your code sample above is exactly the right
fix, because it forces packtime to be greater than revid1's
timestamp.  Thus it will get packed away, leaving only 2 items in
undoInfo.

This certainly passes on Linux, and since you confirm that it also
passes on Windows <wink>, I'll commit the change.

Thanks!
-Barry

[1] http://www.zope.org/Documentation/Developer/Models/ZODB/ZODB_Architecture_Storage_Interface_pack--Callable_Doc.html