Hi, after reading several things about thread safety, i'm a little bit confused by the fact that the words threads and connection are used in too various contexts. So i'll ask a simple question. With a basic Zope server, without any other DB, what happens when two different users want to commit changes made to the same object at the same time ? are the two requests, two different threads ? ZODB speaking.
andre wrote:
Hi,
after reading several things about thread safety, i'm a little bit confused by the fact that the words threads and connection are used in too various contexts.
So i'll ask a simple question.
With a basic Zope server, without any other DB, what happens when two different users want to commit changes made to the same object at the same time ?
are the two requests, two different threads ? ZODB speaking.
Hi André, I am a Zope newbie -big time- but I tend to think that asked with the word 'thread', your question does not make sense. First please do not think that the following lines are pedantic: it is the summary of what I think I learned by hitting so many walls ('appris sur le tas' in French) Second: as a consequence, please correct the slightest stupidities. /Thread/ is a concept that belongs to multi-tasking: how 2 processes access to the memory (volatile). /Connection/ is a concept that belongs to the client-server model. /Commit/ is a concept that belongs to the transactional programming model: it makes durable the actions of a /unit of work/. Threads and unit of works resort to 'some kind of locking' to fulfill their responsibilities but their scope is different. A database is: * a server: as a consequence, a client has access to it via a connection object * probably multi-threaded (but I tend to think that, as a client developer, I don't care except when it comes to performances) * that often supports the concept of transactions * whose transactional behavior can be tweaked via the connection object (via the isolation level). http://www-3.ibm.com/cgi-bin/db2www/data/db2/udb/winos2unix/support/v8infoce... (Look at the phenomena described + follow the link 'isolation levels') André, I would have rephrased your question in 2 questions: * does ZODB supports transactions? * What kind of isolation levels does ZODB support? From what I read so far, the answer to the first question is yes. I do not not know the answer to the second. Regards, -- Gérard
when two different users want to commit changes made to the same object at the same time
In http://www.dieter.handshake.de/pyprojects/zope/zope.html#bct_sec_5.1: 'The ZODB usually guarantees that a transaction does not read inconsistent data by issuing a |ReadConflictError| when it tries to read an object from the ZODB that has been modified since transaction start. Zope usually restarts the transaction in this case.' I would guess so that: * Since there is no such thing as 'at the same time' ... * the /first/ client that will issue a commit will be fine * Without Dieter's patch, the /second/ one should fail because a |ReadConflictError will have been thrown | -- Gérard
G.oogle and Dieter, Thanks for your explanations. English is not my mother language and from time to time i have difficulties to understand the mix of acronyms, jargon, short expressions used between gurus (except 'appris sur le tas' :), and something that first appeared obvious like transaction management becomes 'obscure' after having read messages about the subject. Your answers put a little bit of order in my fresh knowledge. Bye, Andre Gérard Oogle a écrit:
when two different users want to commit changes made to the same object at the same time
In http://www.dieter.handshake.de/pyprojects/zope/zope.html#bct_sec_5.1: 'The ZODB usually guarantees that a transaction does not read inconsistent data by issuing a |ReadConflictError| when it tries to read an object from the ZODB that has been modified since transaction start. Zope usually restarts the transaction in this case.'
I would guess so that:
* Since there is no such thing as 'at the same time' ... * the /first/ client that will issue a commit will be fine * Without Dieter's patch, the /second/ one should fail because a |ReadConflictError will have been thrown |
On Sun, 31 Aug 2003, andre wrote:
G.oogle and Dieter, In an attempt to protect my personal mailbox from increasing spam, I opened recently this g.oogle account.
I now have the feeling that I pushed the gag too far by also faking my name: it is something to protect an account from spam, it is something else to join an open community. In the hope that nobody will have taken offense for this schoolkid joke, I've changed my From+signature back to my real identity. So Andre, you can call me Dominique -- Dominique
Hi Dominique, I hesitated to sign my previous message 'Yves Ahoo' finally i preferred to write to G.Oogle. No offence (V.O.) J'ai hésité à signer mon précédent message Yves Ahoo finalement j'ai préfére écrire à G.Oogle. :) Pas d'offense. PS : Je me demande si je ne vais pas continuer à écrire en V.O. sous-titrée. Je crois bien que c'est le premier message en français que j'envois depuis bien longtemps. Arrivederci Andre Dominique Bordereaux a écrit:
On Sun, 31 Aug 2003, andre wrote:
G.oogle and Dieter,
In an attempt to protect my personal mailbox from increasing spam, I opened recently this g.oogle account.
I now have the feeling that I pushed the gag too far by also faking my name: it is something to protect an account from spam, it is something else to join an open community.
In the hope that nobody will have taken offense for this schoolkid joke, I've changed my From+signature back to my real identity.
So Andre, you can call me Dominique
andre wrote at 2003-8-29 22:15 -0400:
... With a basic Zope server, without any other DB, what happens when two different users want to commit changes made to the same object at the same time ?
One of the requests will get a "ConflictError". Usually, Zope restarts such a request automatically (it tries up to three times). Dieter
participants (4)
-
andre -
Dieter Maurer -
Dominique Bordereaux -
Gérard Oogle