[ZODB-Dev] Concurrent transactions

Kai Diefenbach usenet at diefenba.ch
Fri Jun 1 03:47:27 EDT 2007


Hi, 

After reading some documentation about transactions, concurrency and
atomicity, I don't think that the following issue is a problem, but I'd
be nice to get confirmation from some exports. Or - of course - that it
doesn't behave in the way I think.

Within an adapter I increase a counter (e.g. for every download of an
file) by doing: 
        
        self.counter[0] += 1

self.counter is a PersistentList stored as annotation.

Could there be a problem with concurrent access to the counter? With
other words:

A gets counter = 5
B gets counter (before A writes the increased counter) = 5

A increases and writes the counter => 6 
B increases and writes the counter => 6 (*)

*) In my understanding, here a ConflictError is raised and the whole
transaction will be repeated, that means it starts with the counter of
6. Is this right?

Thanks in advance
Kai

-- 
Kai Diefenbach - http://diefenba.ch
iqplusplus - http://iqpp.de



More information about the ZODB-Dev mailing list