Re: FATAL 2: InitRelink(logfile 0 seg 173) failed: No such file or directory

From: nield(at)usol(dot)com
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, james(at)unifiedmind(dot)com
Subject: Re: FATAL 2: InitRelink(logfile 0 seg 173) failed: No such file or directory
Date: 2002-06-17 18:36:36
Message-ID: C04ZRM5ZC0GD95GAFASN04C7OIPZTYW.3d0e2c34@qw_winnt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

6/17/02 10:16:48 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

>james(at)unifiedmind(dot)com (James Thornton) writes:
>> What does this mean, and what could be causing it?
>> FATAL 2: InitRelink(logfile 0 seg 173) failed: No such file or
>> directory
>> That's the second time in as many months that I have received this
>> error when trying to start postmaster after a crash -- both times a
>> server reboot remedied the issue.
>
>That really should be impossible --- it says that a rename() failed for
>a file we just created.
>
>I judge from the spelling of the error message that you are running 7.1.
>I would recommend an update to 7.2, wherein the error message looks
>more like this:
>
> if (rename(tmppath, path) < 0)
> elog(STOP, "rename from %s to %s (initialization of log file %u,
segment %u) failed: %m",
> tmppath, path, log, seg);
>
[snip]

From the xlog.c file in 7.3devel in InstallXLogFileSegment(), look at the
code near:

> while ((fd = BasicOpenFile(path, O_RDWR | PG_BINARY,
> S_IRUSR | S_IWUSR)) >= 0)

It would seem like we assume that ANY failure of BasicOpenFile() implies
that 'path' does not exist. So then we don't handle any other cases, and
rename might fail because 'path' actually exists.

What if BasicOpenFile() got some other error?

This would seem to be wrong, but it still doesn't explain why
BasicOpenFile() would be failing when 'path' exists in this
particular case.

I don't have the 7.1 or 7.2 code around, and I've never looked at it.

J.R. Nield
nield(at)usol(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-06-17 18:45:52 Re: Table Function (aka SRF) doc patch
Previous Message Dann Corbit 2002-06-17 18:27:45 Re: PostGres Doubt