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

Shane Hathaway shane@zope.com
Tue, 11 Feb 2003 13:20:32 -0500


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.

Having said that, now it seems like marking the connection instead is 
the better way to go.  It would require no changes to the transaction 
machinery, so no backporting would be necessary.

Shane