Hello ! Tom Lane wrote: I hane FreeBSD 6.0-STABLERuslan A Dautkhanov <[EMAIL PROTECTED]> writes:Server rebooted occasionally after power failure. And I have stale postmaster.pid file, so postmaster didn't start with error bill postgres[600]: [1-1] FATAL: file "postmaster.pid" already existsYou probably need a newer postgres version (you didn't say what you are using) and/or a more carefully written start script. and PostgreSQL 8.1.3 on i386-portbld-freebsd6.0, compiled by GCC cc (GCC) 3.4.4 [FreeBSD]. As I said, PostgreSQL was built from freebsd ports, so startup script is also from ports... I know that this is not a good idea, but if it'll keep startup process stable,Your proposed change in the start script is useless --- do you think the postmaster doesn't check that already? Furthermore, it's actually dangerous for reasons we need not get into here; suffice to say that automated removal of that lock file is NOT a good idea. it have rights to exist... Thank you for the information, I'll play with it and try to avoid big if-if-if block in the startup script...The problem comes up when the startup timing is just different enough that the PID belonging to the postmaster in the previous boot cycle now belongs to the shell that's launching it. The postmaster sees a live process of the correct userid (ie, postgres) and has to assume that that's a pre-existing postmaster.We've fixed this in recent releases by having the postmaster also check for a match to its parent process ID (getppid). The care in the start script comes because this only works for one level up. Therefore, you can't "su -c pg_ctl start ..." because that would create three levels of postgres-owned processes (shell, pg_ctl, postmaster) and if the PID count is off by 2 instead of 1 then we still lose. You have to invoke the postmaster directly, "su -c postmaster ...". (Hm, actually it might work to do "su -c 'exec pg_ctl ...'" ... I have not tried that.) -- best regards, Ruslan A Dautkhanov |
smime.p7s
Description: S/MIME Cryptographic Signature