Re: need a method to ping a running database
От | Steve Crawford |
---|---|
Тема | Re: need a method to ping a running database |
Дата | |
Msg-id | 200306121219.49886.scrawford@pinpointresearch.com обсуждение исходный текст |
Ответ на | Re: need a method to ping a running database (Dmitry Tkach <dmitry@openratings.com>) |
Ответы |
Re: need a method to ping a running database
|
Список | pgsql-general |
> Sure. I did not say it was "incorrect"... > But it is *different* from most if not all other errors, because it > requires a different item... It just depends on the use of the script (about which I didn't know the details). If the only purpose is to determine if I can run queries then the simple test will do. If the purpose is to determine whether or not to start/restart the db server then my "script" is not complete. > > Still, I > >think it's safer to look for the existence of expected results that the > >absence of specific error messages. > > I don't know what is "safer" about it... :-) > It seems to be more like a question of taste... Not taste - just the voice of experience from one who has been burned. Suppose your db is on a remote machine and someone screws up DNS so the host doesn't resolve or the db admin has made an error in updating pg_hba.conf or a network cable is unplugged or a routing table is damaged. You can even have something as silly as psql being deleted or not in the path. None of these cases will yield the string "ERROR" so a script that looks for the absence of "ERROR" will say everything is OK. I've given up trying to dream up/test for every possible error - there are too many and once I think I've thought of them all I "discover" another. :) Checking for a known expected result will definitely let you know if the db is or is not available (note, not available != down - just not available to the testing program - again it depends on the purpose of your script). Cheers, Steve
В списке pgsql-general по дате отправления: