Thread: postmaster locking issues.
After looking into the issue of using PID file locks vs. flock/unlock, I have come to the following conclusions: 1. It is generally agreed that a PID lock file should replace the current me- thod of locking (fcntl based locking). (See the message thread with '[HACKERS] flock patch breaks things here' in the subject). 2. The purpose of the lock file is to prevent multiple postmasters from run- ning on the same port and database. 3. Two PID files will be necessary, one to prevent mulitple instances of post- masters from running against the same data base, and one to prevent multiple instances from using the same port. 4. The database lock will be located in the DATA directory being locked. 5. The port lock will be kept in '/var/opt/pgsql/lock/'. Comments, questions, concerns? -- ____ | Billy G. Allie | Domain....: Bill.Allie@mug.org | /| | 7436 Hartwell | Compuserve: 76337,2061 |-/-|----- | Dearborn, MI 48126| MSN.......: B_G_Allie@email.msn.com |/ |LLIE | (313) 582-1540 |
> After looking into the issue of using PID file locks vs. flock/unlock, I have > come to the following conclusions: > > 1. It is generally agreed that a PID lock file should replace the current me- > thod of locking (fcntl based locking). (See the message thread with > '[HACKERS] flock patch breaks things here' in the subject). > > 2. The purpose of the lock file is to prevent multiple postmasters from run- > ning on the same port and database. > > 3. Two PID files will be necessary, one to prevent mulitple instances of post- > masters from running against the same data base, and one to prevent > multiple > instances from using the same port. > > 4. The database lock will be located in the DATA directory being locked. > > 5. The port lock will be kept in '/var/opt/pgsql/lock/'. Yes, except lock file should be kept in /tmp. I don't have /var/opt/..., and I doubt others do either. -- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
> 5. The port lock will be kept in '/var/opt/pgsql/lock/'. Wouldn't the bind() call fail for one of the postmasters if they both try to use the same port? Taral
On Sat, 10 Oct 1998, Bruce Momjian wrote: > > After looking into the issue of using PID file locks vs. flock/unlock, I have > > come to the following conclusions: > > > > 1. It is generally agreed that a PID lock file should replace the current me- > > thod of locking (fcntl based locking). (See the message thread with > > '[HACKERS] flock patch breaks things here' in the subject). > > > > 2. The purpose of the lock file is to prevent multiple postmasters from run- > > ning on the same port and database. > > > > 3. Two PID files will be necessary, one to prevent mulitple instances of post- > > masters from running against the same data base, and one to prevent > > multiple > > instances from using the same port. > > > > 4. The database lock will be located in the DATA directory being locked. > > > > 5. The port lock will be kept in '/var/opt/pgsql/lock/'. > > Yes, except lock file should be kept in /tmp. I don't have > /var/opt/..., and I doubt others do either. My RedHat system doesn't have /var/opt either. I'd agree with /tmp as that's been in every unix style system I've used so far. -- Peter T Mount peter@retep.org.uk Main Homepage: http://www.retep.org.uk PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres Java PDF Generator: http://www.retep.org.uk/pdf