Re: file-locking and postmaster.pid
От | korry |
---|---|
Тема | Re: file-locking and postmaster.pid |
Дата | |
Msg-id | 1148511191.16791.1.camel@sakai.localdomain обсуждение исходный текст |
Ответ на | Re: file-locking and postmaster.pid (Alvaro Herrera <alvherre@commandprompt.com>) |
Список | pgsql-hackers |
<blockquote type="CITE"><pre> <font color="#000000">> > > You never need to reduce it to a shared lock. On postmaster startup,</font> <font color="#000000">> > > try to lock the sentinel byte (one byte past the end-of-file). If you</font> <font color="#000000">> > > can lock it, you know that no other postmaster has that byte locked. If</font> <font color="#000000">> > > you can't lock it, another postmaster is running. It is an atomic</font> <font color="#000000">> > > operation. </font> <font color="#000000">> > </font> <font color="#000000">> > This doesn't work if the postmaster dies but a backend continues to run,</font> <font color="#000000">> > which is arguably the most important case we need to protect against.</font> <font color="#000000">> </font> <font color="#000000">> I may be confused here, but I don't see the problem - byte-range locks</font> <font color="#000000">> are not inherited across a fork. A backend would never hold the lock, a</font> <font color="#000000">> backend would never even look for the lock.</font> <font color="#000000">Well, you are wrong here. We _want_ every backend to hold a shared</font> <font color="#000000">lock. We need to stop a postmaster from starting if there is a backend</font> <font color="#000000">running that was started by a no-longer-running postmaster.</font> </pre></blockquote><pre> </pre> Oh... didn't know that. How is that accomplished now? There must be some code beside the pid file check.<br /><br/> -- Korry<br /><br />
В списке pgsql-hackers по дате отправления: