Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 51503 - postresql 7.4.2-r2 starting pg_autovacuum fails on reboot
Summary: postresql 7.4.2-r2 starting pg_autovacuum fails on reboot
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: All Linux
: High normal
Assignee: PgSQL Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-19 14:05 UTC by Michael Kefeder
Modified: 2004-10-19 00:44 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
waits for postgres to actually run before autovac is started (pg_autovacuum-waitforpgsql.patch,964 bytes, patch)
2004-05-19 14:07 UTC, Michael Kefeder
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kefeder 2004-05-19 14:05:20 UTC
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:
Comment 1 Michael Kefeder 2004-05-19 14:07:27 UTC
Created attachment 31723 [details, diff]
waits for postgres to actually run before autovac is started
Comment 2 Mike Nerone 2004-09-23 15:02:48 UTC
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.
Comment 3 Mike Nerone 2004-09-23 15:04:01 UTC
By the way, dev-db/postgresql-7.4.5 running here.
Comment 4 Michael Kefeder 2004-09-25 05:08:27 UTC
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.
Comment 5 Michael Kefeder 2004-10-19 00:44:54 UTC
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.