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

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: "alvherre(at)alvh(dot)no-ip(dot)org" <alvherre(at)alvh(dot)no-ip(dot)org>, "Bossart, Nathan" <bossartn(at)amazon(dot)com>
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-25 18:00:10
Message-ID: d2b5127c-9df8-48ad-69eb-f4a4feaf9c34@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/08/24 4:55, alvherre(at)alvh(dot)no-ip(dot)org wrote:
> On 2021-Aug-23, Bossart, Nathan wrote:
>
>> Ah, okay. BTW the other changes you mentioned made sense to me.
>
> Thanks. I've pushed this now to all live branches.

Thanks a lot!

+ /*
+ * There's a chance that the record was already flushed to disk and we
+ * missed marking segments as ready for archive. If this happens, we
+ * nudge the WALWriter, which will take care of notifying segments as
+ * needed.
+ */
+ if (StartSeg != EndSeg && XLogArchivingActive() &&
+ LogwrtResult.Flush >= EndPos && ProcGlobal->walwriterLatch)
+ SetLatch(ProcGlobal->walwriterLatch);

Is this really necessary?

If LogwrtResult.Flush >= EndPos, which means that another process already
has flushed the record concurrently and updated XLogCtl->LogwrtResult.Flush.
This situation also means that that another process called
NotifySegmentsReadyForArchive(LogwrtResult.Flush). Right?

If this understanding is right, there seems no need to wake walwriter up here
so that it can call NotifySegmentsReadyForArchive(LogwrtResult.Flush) gain.
Thought?

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bossart, Nathan 2021-08-25 18:18:59 Re: prevent immature WAL streaming
Previous Message Robert Haas 2021-08-25 17:58:41 Re: The Free Space Map: Problems and Opportunities