[Zope] Re: MySQL thread connection question

Tim Peters tim.peters at gmail.com
Sat Aug 21 03:54:48 EDT 2004


[Dieter Maurer]
>> Not true: Zope manages free connections in a stack and
>> opens a new one only when the stack is empty.

[Chris Withers]
> While I can believe that's the intent, the code is far from clear ;-)

...

> I now see why Jim says the version code complicates ZODB more than is
> needed ;-) As I said, I can believe the intent is that, but there's so
> much room for optionality that I'm not convinced that's what actually
> happens...

These are the only lines that matter <0.5 wink>:

            c=pool[-1]
            del pool[-1]

in Db.open().  If an appropriate pool is available, a connection is
reused from the end by exactly those two lines.  When a connection is
returned (_closeConnection()), it's added to the end of the
appropriate pool:

            pool.append(connection)

So all pools are stack-like, until they're exhausted.

There are a couple of good proposals to drastically simplify the
Connection maze (even while retaining versions, if necessary --
Dieter's fondness for them notwithstanding, the primary thing that's
been keeping versions alive is that they *so* complicate so much of
the code that it's dangerous to take them out):

    http://zope.org/Wikis/ZODB/NotesOnPossibleNewZODBConnectionPool
    http://zope.org/Wikis/ZODB/SimplifyConnectionManagement


More information about the Zope mailing list