Re: archive status ".ready" files may be created too early - Mailing list pgsql-hackers

From Bossart, Nathan
Subject Re: archive status ".ready" files may be created too early
Date
Msg-id 83EB9B6A-A6B6-40AB-8B70-0F536CB54BDA@amazon.com
Whole thread Raw
In response to Re: archive status ".ready" files may be created too early  (Andres Freund <andres@anarazel.de>)
Responses Re: archive status ".ready" files may be created too early  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 8/31/21, 1:30 PM, "Andres Freund" <andres@anarazel.de> wrote:
> On 2021-08-31 18:09:36 +0000, Bossart, Nathan wrote:
>> What appears to happen in this case is that bgwriter eventually creates a
>> xl_running_xacts record and nudges walwriter to flush it to disk, at which
>> point the .ready file(s) will be created.  That's admittedly a bit fragile.
>
> That's not guaranteed to happen. If e.g. the partial record is a checkpoint or
> a xl_running_xacts, we'll not trigger further WAL writes in the background,
> unless autovacuum ends up doing something.

Right.  Per the attached patch, a simple way to handle that could be
to teach XLogBackgroundFlush() to flush to the "earliest" segment
boundary if it doesn't find anything else to do.  I think you could
still miss creating a .ready file for the previous segment in single-
user mode, though.

Nathan


Attachment

pgsql-hackers by date:

Previous
From: Ranier Vilela
Date:
Subject: Postgres Win32 build broken?
Next
From: Andres Freund
Date:
Subject: Re: archive status ".ready" files may be created too early