Re: [JDBC] Support for JDBC setQueryTimeout, et al.

From: Radosław Smogura <rsmogura(at)softperience(dot)eu>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: David Fetter <david(at)fetter(dot)org>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>, PostgreSQL JDBC List <pgsql-jdbc(at)postgresql(dot)org>, <robertmhaas(at)gmail(dot)com>, <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: [JDBC] Support for JDBC setQueryTimeout, et al.
Date: 2010-10-15 09:11:44
Message-ID: c17d0cbfea679088a106a9c9b573196c@smogura-softworks.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On Fri, 15 Oct 2010 10:37:05 +0200, Magnus Hagander <magnus(at)hagander(dot)net>
wrote:
>> But... connection pooler will not send RESET ALL in some situations,
>> because JDBC driver can have no notify about switching client. In EE
>> platforms (e. g. Glassfish), server sometimes creates it's own pool and
>> in
>> certain configuration, when you close Connection, server will never
pass
>> close to PooledConection, nor physical connection. This due to fact,
that
>> GF and others adds functionality for statements pooling (if server will
>> call close on pooled conn, then reusing cached statement will cause
>> error -
>> in fact this problem occurs with Hibernate, C3po, XA, and GFv3).
>
> To me, that sounds like a bug in the connection pooler. It is only
> safe under quite limited circumstances.

It's hard to say this is bug. The GF connection pooler is "general pooler"
for all drivers, so it can't know anything about reseting, and if I have
right JDBC4 doesn't support such notifications. It can't close logical
connections, as if would close, cached statements will be invalideted too.

But benefits of pooling statements are much more greater then RESET ALL,
because you can take advance of precompiling prepared statements,
increasing performance; it is comparable to using connection pool instead
of starting physical connections.

In ~2008, Sun published result of (spectest?) Glassfih v2 and PostgreSQL
with special patches allowing statement caching (on JDBC driver side) - it
was the fastest combination, biting all "professional" and highly paid
software.

Probably same wrapping can do JBoss, WAS, and others.

>> in fact this problem occurs with Hibernate, C3po, XA, and GFv3).
Hibernate, with C3P0 hacks and uses some private code, unwraps objects,
etc... :(, so when private implementation changes we have BUM.

> --
>  Magnus Hagander
>  Me: http://www.hagander.net/
>  Work: http://www.redpill-linpro.com/

--
----------
Radosław Smogura
http://www.softperience.eu

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-10-15 09:20:51 Re: [HACKERS] Docs for archive_cleanup_command are poor
Previous Message Dimitri Fontaine 2010-10-15 08:57:41 Re: Extensions, this time with a patch

Browse pgsql-jdbc by date

  From Date Subject
Next Message Stephen Frost 2010-10-15 14:21:26 Re: [JDBC] Support for JDBC setQueryTimeout, et al.
Previous Message Magnus Hagander 2010-10-15 08:37:05 Re: [JDBC] Support for JDBC setQueryTimeout, et al.