From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Thomas Hallgren <thhal(at)mailblocks(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to tell when postmaster is ready |
Date: | 2004-06-10 14:22:14 |
Message-ID: | 24299.1086877334@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thomas Hallgren <thhal(at)mailblocks(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-06-10 14:32:42 | Re: VACUUM FULL produce warnings |
Previous Message | Doug McNaught | 2004-06-10 14:16:12 | Re: Record order change after update |