Re: How to tell when postmaster is ready
От | Tom Lane |
---|---|
Тема | Re: How to tell when postmaster is ready |
Дата | |
Msg-id | 24299.1086877334@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | How to tell when postmaster is ready (Thomas Hallgren <thhal@mailblocks.com>) |
Ответы |
Re: How to tell when postmaster is ready
|
Список | pgsql-general |
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
В списке pgsql-general по дате отправления: