[ZODB-Dev] concurrent list modification problems
Diez Roggisch
d.roggisch at ehotel.de
Wed May 19 18:02:09 EDT 2004
Hi,
I'm using zodb as I've written a few or-mappings too much when I was using
java, and for a single threaded app I'm quite satisfied.
But as I'm in the process of writing a corba-based app server that deals with
several clients which are dispatched on several worker-threads, I ran into
trouble.
My data is basically structured as two-level tree - parent and one level of
childs. So I keep the childs in a PersistentList. The reason for using a list
was that I wanted the childs to be kept in insertion order so I can use their
index as unique key and enumerate them in a defined order.
But I had to find that when two threads acces their copy of a parent that at
the time it was instantiated from the connection had a child list like this:
[a,b,c]
and then append childs
Thread-1: [a,b,c,d,e]
Thread-1: [a,b,c,f,g]
and afterwards commit the changes, that results in the child list beeing
persisted thats been committed last.
first of all I wonder that this is not detected and a ConflictError is raised.
And second, I'd like to know what the comonly used idiom for such a case is -
are PersistenMappings with keys generated from a synchronized sequence better
suited, or whatelse can I do?
Thanks for your help,
Diez B. Roggisch
More information about the ZODB-Dev
mailing list