Re: Possible better pg_ctl start/stop handling?

Поиск
Список
Период
Сортировка
От Joshua D. Drake
Тема Re: Possible better pg_ctl start/stop handling?
Дата
Msg-id 42D2BB9F.6070408@commandprompt.com
обсуждение исходный текст
Ответ на Re: Possible better pg_ctl start/stop handling?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Possible better pg_ctl start/stop handling?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> "Joshua D. Drake" <jd@commandprompt.com> writes:
> 
>>FATAL:  pre-existing shared memory block (key 5432001, ID 19202077) is 
>>still in use
>>HINT:  If you're sure there are no old server processes still running, 
>>remove the shared memory block with the command "ipcclean", "ipcrm", or 
>>just delete the file "postmaster.pid".
> 
> 
>>As we can see pg_ctl knows that the PID does not exist. If the PID does 
>>not exist is it safe to assume that we can remove the file? So that we 
>>may start again?
> 
> 
> The error message is warning you that there appear to still be live
> backends in the data directory, even though the original postmaster
> process is gone (crashed?). 

Yes I am aware of that. My actual point was that pg_ctl test to see if 
the process is alive when you issue the stop. It comes back with the 
error that the PID is no longer available to kill.

I was just wondering if we could make pg_ctl a little smarter as all.
If pg_ctl can't start because the pid file exists, test for the 
existence of the pid, if the pid does not exist test for the existence
of **any** postgres process (grep? egad...), if none exists overwrite 
the pid file and start?

 If that is the case, forcibly starting a
> new postmaster is a fine recipe for creating unrecoverable data
> corruption.  So having pg_ctl auto-remove the file is horribly dangerous
> and is NOT going to happen.

Please understand my thought was not coming lightly. I recognize very 
well (as I have had to deal with customers who have done it) the dangers 
here.

> 
> How did you get into this state anyway?

Power off on a dev machine ;)

Sincerely,

Joshua D. Drake


> 
>             regards, tom lane


-- 
Your PostgreSQL solutions company - Command Prompt, Inc. 1.800.492.2240
PostgreSQL Replication, Consulting, Custom Programming, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, plPerlNG - http://www.commandprompt.com/


В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Hide source code
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Possible better pg_ctl start/stop handling?