From: Lionel B. <lio...@bo...> - 2005-01-12 23:19:47
|
Lionel Bouton wrote the following on 12/29/04 10:09 : >> >> I think there are only two proper ways of solving this: >> 1) In above case, DBI is indicating a clear reason why the connection >> (temporarily) failed. Hence, if DBI returns "DB starting up" as >> error, re-try within sqlgrey until this error is gone. I actually >> think that "DB starting up" is not really an error at all... > > > > Ok, I'll look into it. Having the very same problem on my Gentoo, I looked into the distribution PostgreSQL init scripts and found some interesting code. People seem to be aware of the fact that PostgreSQL isn't available for a short time after the init script exits. They do 2 things : - wait for postmaster.pid to appear inside the PostgreSQL init script (they seem to know PostgreSQL isn't especially quick to load in some cases, reboot from system crash comes to mind). - for pg_autovacuum, the following code is used in its init script : while [ "$CONTINUE" -eq 0 ] && [ $TOO_LONG -lt 10 ] do psql -U $PGUSER -d template1 -c "SELECT 1" 1> /dev/null 2> /dev/null if [ "$?" -eq 0 ] then CONTINUE=1 else echo -n "." TOO_LONG=`expr $TOO_LONG + 1` sleep 1 fi done As I don't want to make sqlgrey dirty with such an hack (after all it could very well sit in the postgresql init script for God's sake), there are two courses of action : - I explain in the FAQ how to modify the postgresql init script to solve the problem and point to it in the HOWTO when adressing the install with PostgreSQL case (my preferred choice), - I add a lot of ugly PostgreSQL-specific things in sqlgrey init script. On Gentoo, I can help solve this by advising people to make sqlgrey depend on pg_autovacuum, the Gentoo init dependency resolver will solve these problems for me :-) Best regards, Lionel. |