Re: [HACKERS] postgres under linux can't start because of postmaster.pid

2007-10-25 Thread Tom Lane
"Richard Wang" <[EMAIL PROTECTED]> writes:
> I just consider this may happens and pg can't recover correctly:
> if postgres crashed last time and left a postmaster.pid file, and last 
> postgres
> id is reused by another process which is not postgres now.

Postgres defends itself against that just fine, at least in any
reasonably recent release.  There are some corner cases where it
could have problems, but scripted hacking on the .pid file is just
about guaranteed to make things worse not better.

regards, tom lane

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] postgres under linux can't start because of postmaster.pid

2007-10-25 Thread Richard Wang
I just consider this may happens and pg can't recover correctly:
if postgres crashed last time and left a postmaster.pid file, and last 
postgres
id is reused by another process which is not postgres now.


"Tom Lane" <[EMAIL PROTECTED]> дÈëÏûÏ¢ÐÂÎÅ:[EMAIL PROTECTED]
> "Richard Wang" <[EMAIL PROTECTED]> writes:
>> I construct a postmaster.pid file and then set the pid to be one of 
>> existing
>> process id(not postgres, e.g vim), then I run postgres. This may happen 
>> if
>> postgres crashed last time and left a postmaster.pid file, and last 
>> postgres
>> id is reused by another process which is not postgres now.
>
> Don't do that.  The postmaster is perfectly capable of recovering on
> its own, why would you want to mess with the postmaster.pid file?
>
> regards, tom lane
>
> ---(end of broadcast)---
> TIP 7: You can help support the PostgreSQL project by donating at
>
>http://www.postgresql.org/about/donate
> 



---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [HACKERS] postgres under linux can't start because of postmaster.pid

2007-10-24 Thread Tom Lane
"Richard Wang" <[EMAIL PROTECTED]> writes:
> I construct a postmaster.pid file and then set the pid to be one of existing 
> process id(not postgres, e.g vim), then I run postgres. This may happen if 
> postgres crashed last time and left a postmaster.pid file, and last postgres 
> id is reused by another process which is not postgres now.

Don't do that.  The postmaster is perfectly capable of recovering on
its own, why would you want to mess with the postmaster.pid file?

regards, tom lane

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate


[HACKERS] postgres under linux can't start because of postmaster.pid

2007-10-24 Thread Richard Wang
I construct a postmaster.pid file and then set the pid to be one of existing 
process id(not postgres, e.g vim), then I run postgres. This may happen if 
postgres crashed last time and left a postmaster.pid file, and last postgres 
id is reused by another process which is not postgres now.

What I expect is that postgres runs normally and overwrites postmaster.pid 
with new postgres id.

In windows it succeeds, but in linux it reports error as follows:
FATAL:  lock file "postmaster.pid" already exists
HINT:  Is another postmaster (PID 9899) running in data directory 
"/home/hcwang/threading/bin/data"?

the pid file content is as follows:
9899
/home/hcwang/postgres/bin/data
  5432001 0

and I run 'ps -u hcwang'
9899 pts/800:00:00 vim

Is this a bug or? Why pg under windows and linux have different behavior?




---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly