On Thu, Mar 22, 2012 at 1:23 PM, Claudiu Saftoiu <csaft...@gmail.com> wrote:
> On Thu, Mar 22, 2012 at 5:29 AM, Vincent Pelletier <vinc...@nexedi.com>
> wrote:
>> Le Wed, 21 Mar 2012 21:04:20 -0400,
>> Claudiu Saftoiu <csaft...@gmail.com> a écrit :
>> > I definitely want to keep the latest update.
>> Then, if the change alters just one persistent object, you can write a
>> conflict resolution method on the class of that object
>> (_p_resolveConflict). Note, through, that this only means you will keep
>> the latest in commit order, not in transaction-begin order.
> Ahh, now that looks promising. Are there any particularly good places to
> get documentation on that sort of thing? All I see when I google are mailing
> list archives.
> Also: is there any easier way to see which objects had a conflict when a
> ConflictError is raised? Currently I am doing a binary-search via commenting
> code, but I figure there must be a better way...

Stop!  Before you go down that road, application-level conflict resolution
if an extremely advanced feature.  It's on the same level as meta classes
and custom import hooks in a Python.  It's a last resort (or maybe the one
after that).

The first thing you need to ask yourself is why your application wants to
update the same value from multiple threads.  This is a hot spot.
Hot spots: bad.  Most applications will need to update the same value from
multiple threads occasionally.  Occasionally retrying is fine.

If your application wants to update the same value from multiple
threads often, then that's a design problem you should solve.


Jim Fulton
For more information about ZODB, see http://zodb.org/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to