From: | "Bossart, Nathan" <bossartn(at)amazon(dot)com> |
---|---|
To: | Andres Freund <andres(at)anarazel(dot)de>, "alvherre(at)alvh(dot)no-ip(dot)org" <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | 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-30 23:08:42 |
Message-ID: | 9FC83463-7422-46DF-AD50-53F16A551A3D@amazon.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 8/30/21, 3:40 PM, "Bossart, Nathan" <bossartn(at)amazon(dot)com> wrote:
> On 8/30/21, 2:06 PM, "Andres Freund" <andres(at)anarazel(dot)de> wrote:
>> Although, the more I think about, the more I am confused about the trailing
>> if (XLogArchivingActive())
>> NotifySegmentsReadyForArchive(LogwrtResult.Flush);
>>
>> in XLogWrite(). Shouldn't that at the very least be inside the "If asked to
>> flush, do so" branch? Outside that and the finishing_seg branch
>> LogwrtResult.Flush won't have moved, right? So the call to
>> NotifySegmentsReadyForArchive() can't do anything, no?
>
> The registration logic looks like this:
> 1. Register boundary
> 2. Get flush location from shared memory
> 3. If flush location >= our just-registered boundary, nudge
> the WAL writer to create .ready files if needed
>
> If we called NotifySegmentsReadyForArchive() before we updated the
> flush location in shared memory, we might skip nudging the WAL writer
> even though we should.
In the other thread [0], we're considering moving boundary
registration to before WALInsertLockRelease(). If I'm right that this
removes the race condition in question, we should be able to move the
call to NotifySegmentsReadyForArchive() at the end of XLogWrite() to
the if-asked-to-flush branch.
Nathan
[0] https://postgr.es/m/DE60B9AA-9670-47DA-9678-6C79BCD884E3%40amazon.com
From | Date | Subject | |
---|---|---|---|
Next Message | Ranier Vilela | 2021-08-30 23:18:45 | Re: Avoid choose invalid number of partitions (src/backend/executor/nodeAgg.c) |
Previous Message | Bossart, Nathan | 2021-08-30 22:39:04 | Re: archive status ".ready" files may be created too early |