freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Nick Kew <niq AT apache.org>
- To: freetds AT lists.ibiblio.org
- Subject: Re: [freetds] Fw: FreeTDS vs Threads
- Date: Fri, 29 Jun 2007 18:04:31 +0100
On Fri, 29 Jun 2007 10:45:45 -0400
"James K. Lowden" <jklowden AT freetds.org> wrote:
> Nick Kew wrote:
> > (a) threads *can* share a DBPROCESS provided Thread 1 cleans up any
> > cursors (or transactions) before Thread 2 uses it.
> > (b) A process can keep a pool of DBPROCESSes, and threads can use
> > different DBPROCESSes in parallel.
> ...
> > Can someone confirm that my assumptions are (or should be) safe
> > and I need to be looking elsewhere for a bug?
>
> There's no relationship between server-side resources -- temporary
> tables, transactions, cursors, etc. -- and client-side threads. The
> db-lib thread restriction derives from the fact that db-lib maintains
> connection state information at the process level: there is one
> connection per process, and that connection's state is kept in the
> process's DBPROCESS structure.
"The process's DBPROCESS structure"?
Are you saying we cannot have more than one DBPROCESS per process?
> In short, db-lib knows nothing of threads. It doesn't care if one
> thread issues the query, another fetches the metadata, and a
> different thread fretches each row. The only contraint is that the
> threads in aggregate must treat the DBPROCESS as a process would,
> making the function calls serially and in the right order.
That's not a problem. The basic architecture is that we maintain
a pool of DBPROCESSes. A thread that needs a database connection
books a DBPROCESS out from the pool, and takes exclusive possession
of it until it's finished with the database. Other threads may
be using other DBPROCESSes independently, in the same way.
The kind of bug that could be lurking in my application would then
involve something failing to clean up fully before returning a
DBPROCESS to the pool.
--
Nick Kew
Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/
-
[freetds] Fw: FreeTDS vs Threads,
Nick Kew, 06/29/2007
-
Re: [freetds] Fw: FreeTDS vs Threads,
James K. Lowden, 06/29/2007
-
Re: [freetds] Fw: FreeTDS vs Threads,
Nick Kew, 06/29/2007
- Re: [freetds] Fw: FreeTDS vs Threads, James K. Lowden, 06/29/2007
-
Re: [freetds] Fw: FreeTDS vs Threads,
Nick Kew, 06/29/2007
-
Re: [freetds] Fw: FreeTDS vs Threads,
James K. Lowden, 06/29/2007
Archive powered by MHonArc 2.6.24.