I switched my development server to kernel 2.6 today and i discovered that when i reboot the machine pg_autovacuum is started right after postgresql starts. The problem is that postgresql takes a few seconds to start and therefore pg_autovacuum can't connect to postgres and fails on bootup. I changed the pg_autovacuum init script to wait for postgres for max. 10 seconds before it starts the vacuum daemon - i sent a patch that shows the changes. Another solution could be to let pg_autovacuum start sometime later in the init process. This problem may not appear on every machine, it depens a lot on hardware specs, but i guess the fix is quite useful slow servers and doesn't hurt fast machines. Reproducible: Always Steps to Reproduce:
Created attachment 31723 [details, diff] waits for postgres to actually run before autovac is started
Problem duplicated here. Last few lines from pg_autovacuum.log: ====================== [2004-09-22 07:53:30 PM] Failed connection to database template1 with error: FATAL: the database system is starting up . [2004-09-22 07:53:30 PM] Failed connection to database template1 with error: FATAL: the database system is starting up . [2004-09-22 07:53:30 PM] Error: Cannot connect to template1, exiting. [2004-09-22 10:32:14 PM] Failed connection to database template1 with error: FATAL: the database system is starting up . [2004-09-22 10:32:14 PM] Failed connection to database template1 with error: FATAL: the database system is starting up . [2004-09-22 10:32:14 PM] Error: Cannot connect to template1, exiting. ================================ Running "/etc/init.d/pg_autovacuum start" after postgres is given a few extra seconds fixes the problem.
By the way, dev-db/postgresql-7.4.5 running here.
it doesn't depend on postgres version, i run 8.0.0beta2 currently, and the init scripts haven't changed for pg_autovacuum. I still use my patched script, because the problem stayed the same. My script may be useless for huge databases where startup takes even longer than 10secs. Maybe there's a way to trigger the autovac startup when postgres finished starting or something? Currently it takes 2 secs on my machine, therefore waiting a max. of 10 secs is ok for me, because it never takes that long. Anyway i think my "waiting" patch is useful, because now there's somebody else having the same problem - any reasons for or against inclusion into the portage tree would be nice to hear.
Seems like my patch made it into the portage tree on 03 Oct 2004. postgresql-7.4.5-r2 will install a new pg_autovacuum init script where my patch is integrated. I guess this is issue is resolved now, therefore i try to change bug-status to FIXED.