Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-29 Thread Bruce Momjian
On Wed, Aug 29, 2012 at 12:56:26AM -0400, Tom Lane wrote: Bruce Momjian br...@momjian.us writes: On Wed, Aug 29, 2012 at 12:24:26AM -0400, Alvaro Herrera wrote: It's a pretty strange line wrap you got in this version of the patch. Normally we just let the string run past the 78 char limit,

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-29 Thread Bruce Momjian
Applied. --- On Wed, Aug 29, 2012 at 08:51:40AM -0400, Bruce Momjian wrote: On Wed, Aug 29, 2012 at 12:56:26AM -0400, Tom Lane wrote: Bruce Momjian br...@momjian.us writes: On Wed, Aug 29, 2012 at 12:24:26AM -0400,

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-28 Thread Bruce Momjian
On Mon, Aug 27, 2012 at 10:17:43PM -0400, Bruce Momjian wrote: Seems pg_ctl would also need some cleanup if we change the error message and/or timing. I am thinking we should just change the error message in the postmaster and pg_ctl to say the file is empty, and call it done (no hint

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-28 Thread Tom Lane
Bruce Momjian br...@momjian.us writes: Updated patch attached which just reports the file as empty. I assume we don't want the extra text output for pg_ctl like we do for the backend. The backend side of this looks mostly sane to me (but drop the \n, messages are not supposed to contain

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-28 Thread Bruce Momjian
On Tue, Aug 28, 2012 at 04:25:36PM -0400, Tom Lane wrote: Bruce Momjian br...@momjian.us writes: Updated patch attached which just reports the file as empty. I assume we don't want the extra text output for pg_ctl like we do for the backend. The backend side of this looks mostly sane to

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-28 Thread Tom Lane
Bruce Momjian br...@momjian.us writes: On Tue, Aug 28, 2012 at 04:25:36PM -0400, Tom Lane wrote: The backend side of this looks mostly sane to me (but drop the \n, messages are not supposed to contain those). But the feof test proposed Removed. I thought we needed to add \n so that strings

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-28 Thread Alvaro Herrera
Excerpts from Bruce Momjian's message of mar ago 28 22:21:27 -0400 2012: On Tue, Aug 28, 2012 at 04:25:36PM -0400, Tom Lane wrote: Bruce Momjian br...@momjian.us writes: Updated patch attached which just reports the file as empty. I assume we don't want the extra text output for pg_ctl

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-28 Thread Bruce Momjian
On Wed, Aug 29, 2012 at 12:24:26AM -0400, Alvaro Herrera wrote: Excerpts from Bruce Momjian's message of mar ago 28 22:21:27 -0400 2012: On Tue, Aug 28, 2012 at 04:25:36PM -0400, Tom Lane wrote: Bruce Momjian br...@momjian.us writes: Updated patch attached which just reports the file as

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-28 Thread Tom Lane
Bruce Momjian br...@momjian.us writes: On Wed, Aug 29, 2012 at 12:24:26AM -0400, Alvaro Herrera wrote: It's a pretty strange line wrap you got in this version of the patch. Normally we just let the string run past the 78 char limit, without cutting it in any way. And moving the start of the

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-27 Thread Tom Lane
Bruce Momjian br...@momjian.us writes: I have developed the attached patch to report a zero-length file, as you suggested. DIRECTORY_LOCK_FILE is entirely incorrect there. Taking a step back, I don't think this message is much better than the existing behavior of reporting bogus data. Either

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-27 Thread Robert Haas
On Mon, Aug 27, 2012 at 4:29 PM, Tom Lane t...@sss.pgh.pa.us wrote: Bruce Momjian br...@momjian.us writes: I have developed the attached patch to report a zero-length file, as you suggested. DIRECTORY_LOCK_FILE is entirely incorrect there. Taking a step back, I don't think this message is

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-27 Thread Alvaro Herrera
Excerpts from Robert Haas's message of lun ago 27 18:02:06 -0400 2012: On Mon, Aug 27, 2012 at 4:29 PM, Tom Lane t...@sss.pgh.pa.us wrote: Bruce Momjian br...@momjian.us writes: I have developed the attached patch to report a zero-length file, as you suggested. DIRECTORY_LOCK_FILE is

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-27 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Mon, Aug 27, 2012 at 4:29 PM, Tom Lane t...@sss.pgh.pa.us wrote: Perhaps something like: FATAL: lock file foo is empty HINT: This may mean that another postmaster was starting at the same time. If not, remove the lock file and try again. The

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-27 Thread Tom Lane
Alvaro Herrera alvhe...@2ndquadrant.com writes: How about having it sleep for a short while, then try again? I could get behind that, but I don't think the delay should be more than 100ms or so. It's important for the postmaster to acquire the lock (or not) pretty quickly, or pg_ctl is going to

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-27 Thread Bruce Momjian
On Mon, Aug 27, 2012 at 07:39:35PM -0400, Tom Lane wrote: Alvaro Herrera alvhe...@2ndquadrant.com writes: How about having it sleep for a short while, then try again? I could get behind that, but I don't think the delay should be more than 100ms or so. It's important for the postmaster to

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-27 Thread Tom Lane
Bruce Momjian br...@momjian.us writes: On Mon, Aug 27, 2012 at 07:39:35PM -0400, Tom Lane wrote: I could get behind that, but I don't think the delay should be more than 100ms or so. I took Alvaro's approach of a sleep. The file test was already in a loop that went 100 times. Basically, if

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-27 Thread Bruce Momjian
On Mon, Aug 27, 2012 at 09:59:10PM -0400, Tom Lane wrote: Bruce Momjian br...@momjian.us writes: On Mon, Aug 27, 2012 at 07:39:35PM -0400, Tom Lane wrote: I could get behind that, but I don't think the delay should be more than 100ms or so. I took Alvaro's approach of a sleep. The file

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-08-26 Thread Bruce Momjian
On Fri, Jan 6, 2012 at 08:28:48AM -0500, Michael Beattie wrote: On Fri, Jan 6, 2012 at 6:13 AM, Magnus Hagander mag...@hagander.net wrote: On Thu, Jan 5, 2012 at 23:19, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net writes: On Thu, Jan 5, 2012 at 17:13,

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-01-06 Thread Magnus Hagander
On Thu, Jan 5, 2012 at 23:19, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net writes: On Thu, Jan 5, 2012 at 17:13, Tom Lane t...@sss.pgh.pa.us wrote: I think link(2) would create race conditions of its own.  I'd be inclined to suggest that maybe we should just

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-01-06 Thread Michael Beattie
On Fri, Jan 6, 2012 at 6:13 AM, Magnus Hagander mag...@hagander.net wrote: On Thu, Jan 5, 2012 at 23:19, Tom Lane t...@sss.pgh.pa.us wrote: Magnus Hagander mag...@hagander.net writes: On Thu, Jan 5, 2012 at 17:13, Tom Lane t...@sss.pgh.pa.us wrote: I think link(2) would create race

[HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-01-05 Thread Heikki Linnakangas
My laptop ran out of battery and turned itself off while I was just starting up postmaster. After plugging in the charger and rebooting, I got the following error when I tried to restart PostgreSQL: FATAL: bogus data in lock file postmaster.pid: postmaster.pid file was present in the data

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-01-05 Thread Magnus Hagander
On Thu, Jan 5, 2012 at 14:18, Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: My laptop ran out of battery and turned itself off while I was just starting up postmaster. After plugging in the charger and rebooting, I got the following error when I tried to restart PostgreSQL:

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-01-05 Thread Robert Haas
On Thu, Jan 5, 2012 at 8:23 AM, Magnus Hagander mag...@hagander.net wrote: On Thu, Jan 5, 2012 at 14:18, Heikki Linnakangas heikki.linnakan...@enterprisedb.com wrote: My laptop ran out of battery and turned itself off while I was just starting up postmaster. After plugging in the charger and

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-01-05 Thread Tom Lane
Heikki Linnakangas heikki.linnakan...@enterprisedb.com writes: My laptop ran out of battery and turned itself off while I was just starting up postmaster. After plugging in the charger and rebooting, I got the following error when I tried to restart PostgreSQL: FATAL: bogus data in lock

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-01-05 Thread Magnus Hagander
On Thu, Jan 5, 2012 at 17:13, Tom Lane t...@sss.pgh.pa.us wrote: Heikki Linnakangas heikki.linnakan...@enterprisedb.com writes: My laptop ran out of battery and turned itself off while I was just starting up postmaster. After plugging in the charger and rebooting, I got the following error

Re: [HACKERS] FATAL: bogus data in lock file postmaster.pid:

2012-01-05 Thread Tom Lane
Magnus Hagander mag...@hagander.net writes: On Thu, Jan 5, 2012 at 17:13, Tom Lane t...@sss.pgh.pa.us wrote: I think link(2) would create race conditions of its own. I'd be inclined to suggest that maybe we should just special-case a zero length postmaster.pid file as meaning okay to proceed.