[ZODB-Dev] Help: ZODB undo problem

Mike C. Fletcher mcfletch@rogers.com
Thu, 20 Jun 2002 01:45:33 -0400


Regarding ZODB3 versus ZODB4:

	ZODB4 is the only ZODB that will allow propertied new-style objects, I 
believe. (Am I wrong?)  Everything in my system is propertied (that's a 
fundamental design decision, no way to change it now short of rewriting 
the whole application), so I went with ZODB4.  I was under the 
impression it was just ZODB3 with some (minor) changes to support the 
new-style classes.  Guess I was wrong there.

Regarding _resetCache:
	Are you sure about what happens in the situation you described (holding 
onto a reference to an item originally in the cache?)  That sounds 
exactly like what I was doing, and the result was the ConflictError. 
There doesn't appear to be any corruption of the database (any commit 
that would save the corrupted version is rejected, so there's just no 
way of continuing through the error AFAICS), but that's not a 
fully-tested statement.

Regarding reset:
	I suppose I'm okay with it going away (like my opinion matters ;) ).  I 
hadn't actually tested taking out just the reset (I'd taken out the 
reset and the synch for testing, seen it fail then been distracted by 
another bug somewhere before I tested just removing reset).

Regarding Hair:
	That's why I wear my hair long, makes it less of a loss when a little 
decides to wander away :) .  Seriously, I know ZODB4 is early-stages 
software. Seeing it based on such a stable piece of software (ZODB3) I 
was probably hoping for too much reliability at this stage.  This little 
application won't go final for a month or two, so hopefully ZODB4 will 
be (more) stable by then.

Thanks again,
Mike



Shane Hathaway wrote:
> Mike C. Fletcher wrote:
> 
>> Updates:
>>     reset is definitely there in my copy of Zope3's ZODB (downloaded 
>> and re-built today).  I'm thinking I wasn't clear in the problem 
>> statement that it's Zope3, not Zope2 ZODB I'm using.  Leaving out any 
>> of the three 
> 
>             ^^^^^
> 
> Here's your problem.  You really can't expect Zope3 ZODB (aka ZODB4) to 
> work well.  It's pre-pre-pre-alpha. ;-)
> 
> I just looked at the reset() method, and it really should not be there. 
>  Someone apparently interpreted the presence of some code in Zope 2 as a 
> requirement for new code.  I am the author of the original _resetCache() 
> method (which reset() calls) and I wrote it only to support the Zope 
> "Refresh" function.  It is dangerous--it will eat your objects alive.  
> Looks innocuous, doesn't it?  Well, what happens if you hold on to a 
> reference to an object that has been severed from the cache using 
> reset(), load a second copy of the object into the cache using normal 
> mechanisms, then modify the disconnected object?  ZODB will become 
> inconsistent.  Slowly, corruption will enter into your program. Next 
> time you restart, ZODB will load your objects, but they might not be the 
> objects you expected!  You may lose some hair! ;-)
> 
> Your program needs only the standard invalidation mechanisms, and they 
> are always enabled.  If sync() does not solve the problem, it's very 
> likely a ZODB bug, and you can't safely work around it with reset().
> 
> Why don't you use Zope2 ZODB?  It works fine with Python 2.2 and even 
> 2.3 (CVS).  It has been proven in battle.  sync() works.
> 
> Shane
> 
> P.S. unless there are any objections, I am going to remove the reset() 
> method, so no one else falls into this trap.
> 
> 


-- 
_______________________________________
   Mike C. Fletcher
   http://members.rogers.com/mcfletch/