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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-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

Browse pgsql-bugs by date

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

Browse pgsql-patches by date

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