Re: archive status ".ready" files may be created too early

From: "Bossart, Nathan" <bossartn(at)amazon(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: "alvherre(at)alvh(dot)no-ip(dot)org" <alvherre(at)alvh(dot)no-ip(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, "x4mmm(at)yandex-team(dot)ru" <x4mmm(at)yandex-team(dot)ru>, "a(dot)lubennikova(at)postgrespro(dot)ru" <a(dot)lubennikova(at)postgrespro(dot)ru>, "hlinnaka(at)iki(dot)fi" <hlinnaka(at)iki(dot)fi>, "matsumura(dot)ryo(at)fujitsu(dot)com" <matsumura(dot)ryo(at)fujitsu(dot)com>, "masao(dot)fujii(at)gmail(dot)com" <masao(dot)fujii(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: archive status ".ready" files may be created too early
Date: 2021-08-31 23:31:15
Message-ID: 83EB9B6A-A6B6-40AB-8B70-0F536CB54BDA@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/31/21, 1:30 PM, "Andres Freund" <andres(at)anarazel(dot)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 Content-Type Size
flush-to-boundary.patch application/octet-stream 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2021-09-01 00:23:47 Re: archive status ".ready" files may be created too early
Previous Message Ranier Vilela 2021-08-31 22:49:40 Postgres Win32 build broken?