6/17/02 10:16:48 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>james@unifiedmind.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@usol.com