[Zope-dev] Re: Bare "except" dangerous to ZODB?

Romain Slootmaekers romain@zzict.com
Tue, 11 Feb 2003 21:09:56 +0100


Shane Hathaway wrote:
> Jeremy Hylton wrote:
> 
>> On Tue, 2003-02-11 at 12:10, Shane Hathaway wrote:
>>
>>> I added a test to testZODB.py on a new branch 
>>> (shane-conflict-handling-branch) that exercises the conflict handling 
>>> bug.  The test currently fails.  It might be simpler to go with 
>>> Toby's implementation for now: add a "veto" object to the transaction 
>>> that refuses any attempt to commit.  But maybe your transaction 
>>> states are better.  Let me know what you want to do.
>>
>>
>>
>> I'd like to do the transaction states, because it would keep the code in
>> zodb3 and zodb4 similar.  Unless there's a reason to think there are
>> problems with the transaction state approach.
> 
> 
> That would be fine.  We only need all tests (including the new test) to 
> pass. :-)
> 
>> I didn't look carefully at the test, but if I remember the discussion
>> last time around, the problem is with read conflicts caught outside of
>> 2PC.  In that case, we either need to mark the connection so that it
>> votes no when it gets to prepare() or we need to veto() method.  I'd
>> prefer the vote-no-in-prepare because it keeps the API smaller, but
>> veto() isn't so bad; maybe it's better to stop the transaction quickly.
> 
> 
> If we have veto(), it should probably expect a string argument that 
> explains the reason for the veto.  Then if something tries to commit, we 
> can raise VetoedError(explanation).  Otherwise, it seems like failed 
> transactions would be opaque and hard to decipher.

hm this is starting to look an awful lot like Persistent Java Beans.
maybe you should take a look there and borrow some architecture.

Sloot.