Re: How to tell when postmaster is ready - Mailing list pgsql-general

From Thomas Hallgren
Subject Re: How to tell when postmaster is ready
Date
Msg-id 40C8A88F.2080401@mailblocks.com
Whole thread Raw
In response to Re: How to tell when postmaster is ready  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Tom Lane wrote:

>Thomas Hallgren <thhal@mailblocks.com> writes:
>
>
>>I'm writing a small test harness. I have two threads. One that starts
>>the postmaster and another that does all the testing and finally stops
>>the postmaster with a pg_ctl stop. At present, the second thread starts
>>with a sleep sufficient to ensure that the postmaster is running. Is
>>there a proper way to test when the postmaster is ready to receive commands?
>>
>>
>
>Check to see if it answers a connection request.  If you look in the
>archives for discussion of a "pg_ping" utility you'll find more about
>this.  My recollection is that we'd tweaked the postmaster's behavior
>so that a useful pg_ping could be written (in particular, that you'd
>not need to know a valid database/user name to check for postmaster
>ready), but then no one got round to actually writing it.
>
>Now that pg_ctl is in C, it would likely make sense to rewrite its
>postmaster probing as per the pg_ping ideas instead of trying to open
>a normal connection.
>
>(As for your test harness, though, you could just use pg_ctl start
>with the wait option, and wait for it to finish...)
>
>            regards, tom lane
>
>
Thanks (to all who replied). I think have what I need to make good progress.

(I did try using pg_ctl start but I encountered several problems on
win32 when attempting to pass -c options to the postmaster. Seems to be
some problem concerning who parses what, the shell or pg_ctl (windows is
utterly stupid when it comes to command line parsing). And using the
wait option seemed to wait forever on win32. I'm still investigating,
will get back to you if I find something relevant).

Kind regards,

Thomas Hallgren



pgsql-general by date:

Previous
From: Mikhail Terekhov
Date:
Subject: Re: postgres on SuSE 9.1
Next
From: Mikhail Terekhov
Date:
Subject: Re: [HACKERS] The pgreplication project