gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] pooling connections


From: Julio Jiménez
Subject: Re: [Gnumed-devel] pooling connections
Date: Sun, 01 Sep 2002 15:37:55 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020623 Debian/1.0.0-0.woody.1

Horst Herb wrote:

On Sun, 1 Sep 2002 09:33 pm, Julio Jiménez wrote:

It's true.. "commits" are at connections levels. But I think you musn't
have 20 connections for it. you
must issolate and serialize the transactions (don execute cursors for
insert, update... until really need to be upgraded, then apply
connection.commit()) this is the way i usually use.

Let us assume you have the processes A and B.
Both request a connection C, and get the same connection.
A begins a long transaction, B a short one.
B commit fails, rollback is triggered.
If A and B share the same connection, *both* transactions would be rolled back, wouldn't they?
well, of course all pendings transactions will rolled back..., but what I say is that serialize and isolate the transactions... to know... don't send any transaction (cursor.execute()) for any cursor untill you really need to finish.

I suppose A and B are cursors for C conecction... and wat two transactions

you can

A.execute('insert....')
A.execute('delete....')
A.execute('update....')
[...]
fo finish...
C.commit()


B.execute('insert....')
B.execute('delete....')
B.execute('update....')
[...]
fo finish...
C.commit() or C.rollback() (only B cursor is afected)

You can't
A.execute('insert....')
A.execute('delete....')
B.execute('insert....')
B.execute('delete....')
B.rollback()  #wrong
then
c.rollback() finish all transactions for A and B


Can you isolate transactions in this way?
Do you need keep insert... delete... pending for commit while the progam is running?

When you say...

"the processes A and B."

Do you mean cursors or multy-threaded procceses...


Julio Jiménez





reply via email to

[Prev in Thread] Current Thread [Next in Thread]