From: | "Bossart, Nathan" <bossartn(at)amazon(dot)com> |
---|---|
To: | "alvherre(at)alvh(dot)no-ip(dot)org" <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | 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-18 19:07:18 |
Message-ID: | 05AD5FE2-9A53-4D11-A3F8-3A83EBB0EB93@amazon.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 8/18/21, 11:31 AM, "alvherre(at)alvh(dot)no-ip(dot)org" <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> I was wondering which would be better: before or after.
> XLogBackgroundFlush would do it anyway, so if you do it after then it's
> not clear to me that it'd do anything (I mean we should not do any new
> calls of NotifySegmentsReadyForArchive and just rely on the one in
> XLogBackgroundFlush -> XLogWrite).
>
> The advantage of doing NotifySegmentsReadyForArchive before
> XLogBackgroundFlush is that the files would be created sooner, so the
> archiver can be working in parallel while walwriter does its other
> thing; then we'd reach the NotifySegmentsReadyForArchive in
> XLogBackgroundFlush and it'd find nothing to do most of the time, which
> is just fine.
As long as XLogBackgroundFlush() found work to do, it would take care
of notifying, but I don't think we can depend on that. However, since
we're primarily using the WAL writer to take care of the case when the
record has already been flushed, notifying beforehand seems fine to
me. If XLogBackgroundFlush() does end up calling XLogWrite(), it'll
call it again, anyway.
In the attached patch, I modified XLogInsertRecord() to simply set the
latch if we detect that flushRecPtr has advanced.
Nathan
Attachment | Content-Type | Size |
---|---|---|
v9-0001-Avoid-creating-archive-status-.ready-files-too-ea.patch | application/octet-stream | 20.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2021-08-18 19:15:21 | Re: strange case of "if ((a & b))" |
Previous Message | alvherre@alvh.no-ip.org | 2021-08-18 18:30:05 | Re: archive status ".ready" files may be created too early |