Skip site navigation (1) Skip section navigation (2)

Re: [Win32] Problem with rename()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Peter Brant" <Peter(dot)Brant(at)wicourts(dot)gov>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [Win32] Problem with rename()
Date: 2006-04-18 18:03:40
Message-ID: 17351.1145383420@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-patches
I wrote:
> "Peter Brant" <Peter(dot)Brant(at)wicourts(dot)gov> writes:
>> Shortly thereafter, Postgres becomes unresponsive.  Attempts to make a
>> new connection just block.  Autovacuums block.  A "pg_ctl ... stop -m
>> fast" doesn't work.  Only "pg_ctl ... stop -m immediate" does.

> BTW, whatever we decide to do about the rename problem, I'd say that the
> second point represents an independent bug.  The rename loop would hang
> up the bgwriter, which would probably cause performance to tank, but the
> rest of the system shouldn't become completely unresponsive because of
> an incomplete checkpoint.  The checkpoint operation shouldn't be holding
> any critical locks at this point.

I looked into this and found out that in fact, InstallXLogFileSegment
holds the ControlFileLock while trying to rename the WAL segment file.
It does this specifically as an interlock against someone else trying
to create the same new WAL segment name.  So once the system runs out
of already-created WAL segments, XLogFileInit hangs up on the lock,
and then anything that wants to generate WAL entries is blocked.

It's possible that we could avoid using a lock here, but it would
require accepting some errors in creation/renaming of WAL segments as
being expected rather than fatal conditions.  That seems a bit risky to
me, particularly for the Windows port where I have zero confidence that
I understand what errors Windows might report :-(.  Maybe such a cure
is worse than the disease, since we intend to do something about fixing
the rename problem anyway.  Any comments?

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Peter BrantDate: 2006-04-18 18:32:43
Subject: Re: [Win32] Problem with rename()
Previous:From: Tom LaneDate: 2006-04-18 17:35:39
Subject: Re: Permission denied on fsync / Win32 (was right

pgsql-patches by date

Next:From: Peter BrantDate: 2006-04-18 18:32:43
Subject: Re: [Win32] Problem with rename()
Previous:From: Tom LaneDate: 2006-04-18 17:09:09
Subject: Re: [Win32] Problem with rename()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group