[ZODB-Dev] undo and zodb
Jeremy Hylton
jeremy@zope.com
Tue, 3 Sep 2002 18:09:48 -0400
>>>>> "TD" == Toby Dickenson <tdickenson@geminidataloggers.com> writes:
TD> On Tuesday 03 Sep 2002 4:43 pm, Jeremy Hylton wrote:
>> I don't think you need to worry about this problem being
>> exacerbated by conflict resolution. CR only deals with the state
>> of a single object. That object must exist in the database, or
>> its CR method would not have been called.
TD> consider this scenario:
TD> 1. object A has a reference to object B
TD> 2. two transactions start
TD> 3. the first transaction modifies A by deleting the reference to
TD> B, and commits.
TD> 4. the second transaction modifies A in a different way
TD> 5. a conflict in A is detected when committing the second
TD> transaction
TD> 6. the conflict resolution method is given three states. The
TD> original, the state committed by the first transaction in
TD> step 1, and the state created by the second transaction in
TD> step 4. It returns a new state which does include the
TD> reference to object B.
TD> From the storage point of view, object B is unreferenced between
TD> steps 3 and
TD> 6. It could be removed by packing.
TD> Jim argues that this conflict resolution method is broken,
TD> because it ignores the change made by the first transaction. Im
TD> not sure this will prove to be true in all cases.
In the absence of a compelling example, I'm firmly in Jim's camp. If
a CR method resolves a conflict by ignoring the actions of an earlier
transaction where the earlier transaction deleted an object, ZODB
can't provide any integrity guarantees.
If we wanted to be really careful, we could raise an exception if a CR
method revived a packed-away dead object. I think the exception would
help preserve integrity, but it's so unlikely to occur in practice
that I'm not sure it's worth it.
Jeremy