X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx2.hub.org [200.46.204.254]) by postgresql.org (Postfix) with ESMTP id 09BAA11F7D67 for ; Thu, 20 Apr 2006 05:11:29 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: -2.599 X-Spam-Level: X-Spam-Status: No, score=-2.599 required=5 tests=[BAYES_00=-2.599] Received: from postgresql.org ([200.46.204.71]) by localhost (mx2.hub.org [200.46.204.254]) (amavisd-new, port 10024) with ESMTP id ipVwsHYhIciL for ; Thu, 20 Apr 2006 05:11:26 -0300 (ADT) X-Greylist: delayed 00:20:21.842142 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id BAF6211F7AB3 for ; Thu, 20 Apr 2006 05:11:21 -0300 (ADT) Received: from astro.systems.pipex.net (astro.systems.pipex.net [62.241.163.6]) by svr4.postgresql.org (Postfix) with ESMTP id F3F615AF18B for ; Thu, 20 Apr 2006 07:51:01 +0000 (GMT) Received: from corona (81-179-122-106.dsl.pipex.com [81.179.122.106]) by astro.systems.pipex.net (Postfix) with ESMTP id 218A6E0002F0; Thu, 20 Apr 2006 08:50:53 +0100 (BST) Subject: Re: [PATCH] Support for ping method. From: Michael Barker To: Kris Jurka Cc: pgsql-jdbc@postgresql.org, Andy Oliver In-Reply-To: References: <1144305529.2955.11.camel@corona> Content-Type: text/plain Date: Thu, 20 Apr 2006 08:48:10 +0100 Message-Id: <1145519290.2569.0.camel@corona> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Archive-Number: 200604/137 X-Sequence-Number: 15071 Hi Kris, Dump the patch, we will use an empty select. Regards, Michael Barker. On Mon, 2006-04-17 at 01:37 -0500, Kris Jurka wrote: > > On Thu, 6 Apr 2006, Michael Barker wrote: > > > Attached is a patch that adds support for a ping method on the > > AbstractJdbc2Connection. This is useful for JBoss (and other > > containers) where the container needs to check if the connection is > > alive before passing it to the caller. Currently JBoss does a "SELECT > > 1", but using the new ping method there is a boost in performance. > > Opening and closing 1000 connections from a datasource: > > > > There are a number of problems with this patch. In no particular order... > > 1) publicly accessible postgresql specific functions should be exported > in the org.postgresql.PGConnection interface or similar. Client code > should not attempt to cast a connection to any other interface. > > 2) The ping method in QueryExecutorImpl must be synchronized to avoid > interfering with other threads use of the backend connection. > > 3) The error handling is non-existent. It swallows all kinds of errors > and leaves the protocol stream in an unknown state leaving the caller > responsible for cleanup. At worst it should close the connection and > throw some sort of exception. > > 4) It is possible that the first response from a Sync message on a > valid connection will not be a ReadyForQuery message. Consider the > case of asynchronous Notify messages appearing. These must be > processed by the driver as it waits for the ReadyForQuery > message to arrive. > > 5) It lacks V2 protocol support. While V2 does not have a Sync message, > it does have something similar. By sending a query of the empty string > you will receive an EmptyQuery message immediately that should not require > any significant backend processing. > > Kris Jurka >