Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 161B11337B5A for ; Wed, 17 Nov 2010 22:54:43 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 76592-06 for ; Thu, 18 Nov 2010 02:54:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id 8F1261337B58 for ; Wed, 17 Nov 2010 22:54:35 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id oAI2sXK17185; Wed, 17 Nov 2010 21:54:33 -0500 (EST) From: Bruce Momjian Message-Id: <201011180254.oAI2sXK17185@momjian.us> Subject: Re: Re: [BUGS] BUG #5650: Postgres service showing as stopped when in fact it is running In-Reply-To: <25379.1290032634@sss.pgh.pa.us> To: Tom Lane Date: Wed, 17 Nov 2010 21:54:33 -0500 (EST) CC: Magnus Hagander , Ashesh Vashi , Mark Llewellyn , pgsql-hackers@postgresql.org, Sujeet Rajguru X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/1142 X-Sequence-Number: 174285 Tom Lane wrote: > Bruce Momjian writes: > > Tom Lane wrote: > >> Possibly the cleanest fix is to implement pg_ping as a libpq function. > >> You do have to distinguish connection failures (ie connection refused) > >> from errors that came back from the postmaster, and the easiest place to > >> be doing that is inside libpq. > > > OK, so a new libpq function --- got it. Would we just pass the status > > from the backend or can it be done without backend modifications? > > It would definitely be better to do it without backend mods, so that > the functionality would work against back-branch postmasters. > > To my mind, the entire purpose of such a function is to classify the > possible errors so that the caller doesn't have to. So I wouldn't > consider that it ought to "pass back the status from the backend". > I think what we basically want is a function that takes a conninfo > string (or one of the variants of that) and returns an enum defined > more or less like this: > > * failed to connect to postmaster > * connected, but postmaster is not accepting sessions > * postmaster is up and accepting sessions > > I'm not sure those are exactly the categories we want, but something > close to that. In particular, I don't know if there's any value in > subdividing the "not accepting sessions" status --- pg_ctl doesn't > really care, but other use-cases might want to tell the difference > between the various canAcceptConnections failure states. > > BTW, it is annoying that we can't definitively distinguish "postmaster > is not running" from a connectivity problem, but I can't see a way > around that. Agreed. I will research this. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +