Re: file-locking and postmaster.pid
От | Alvaro Herrera |
---|---|
Тема | Re: file-locking and postmaster.pid |
Дата | |
Msg-id | 20060524223857.GE7412@surnet.cl обсуждение исходный текст |
Ответ на | Re: file-locking and postmaster.pid (korry <korry@appx.com>) |
Ответы |
Re: file-locking and postmaster.pid
Re: file-locking and postmaster.pid |
Список | pgsql-hackers |
korry wrote: > > > You never need to reduce it to a shared lock. On postmaster startup, > > > try to lock the sentinel byte (one byte past the end-of-file). If you > > > can lock it, you know that no other postmaster has that byte locked. If > > > you can't lock it, another postmaster is running. It is an atomic > > > operation. > > > > This doesn't work if the postmaster dies but a backend continues to run, > > which is arguably the most important case we need to protect against. > > I may be confused here, but I don't see the problem - byte-range locks > are not inherited across a fork. A backend would never hold the lock, a > backend would never even look for the lock. Well, you are wrong here. We _want_ every backend to hold a shared lock. We need to stop a postmaster from starting if there is a backend running that was started by a no-longer-running postmaster. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.
В списке pgsql-hackers по дате отправления: