[ZODB-Dev] understanding _p_resolveConflict
Bakhtiar A Hamid
kedai at kedai.com.my
Wed Aug 4 02:19:21 EDT 2004
first off, apologies if this is too obvious a question.
i have a zope product that writes to the zodb in its lifetime. with
small-medium load/requests, everything works great. however, with more load,
the product encountered ConflictError.
ok, let's try and do our own app level conflict resolution. and ive read and
reread the zodb programmers guide.
say i have
class myclass:
def __init__(self,var1='',var2=[]):
self.var1=var1
self.var2 = var2
def _p_resolveConflict(self,oldstate,savedstate,newstate):
return newstate
the code seems to work since i no longer got massive ConflictError. now
there's some ReadConflictError (which is ok, i guess)
my understanding/questions:
-oldstate, savedstate and newstate are dicts. it's not REQUESTS
-what do we need to compare/merge? say i'm interested with var2. and do
something like this:
def _p_resolveConflict(self,oldstate,savedstate,newstate):
import difflib
#difflib.unified_diff(savedstate['var1'],newstate['var1'])
#if no diff, use oldstate
#else use newstate
return xxx #where xxx is what?
-what do i return? the state i want?
i feel stupid asking these questions, but got nowhere else to ask :P.
thanks
More information about the ZODB-Dev
mailing list