Re: Race between KeepFileRestoredFromArchive() and restartpoint

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: noah(at)leadboat(dot)com
Cc: don(at)seiler(dot)us, david(at)pgmasters(dot)net, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Race between KeepFileRestoredFromArchive() and restartpoint
Date: 2022-08-03 08:15:17
Message-ID: 20220803.171517.360993762609663695.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Wed, 3 Aug 2022 00:28:47 -0700, Noah Misch <noah(at)leadboat(dot)com> wrote in
> On Wed, Aug 03, 2022 at 11:24:17AM +0900, Kyotaro Horiguchi wrote:
> > At Tue, 2 Aug 2022 16:03:42 -0500, Don Seiler <don(at)seiler(dot)us> wrote in
> > > could not link file “pg_wal/xlogtemp.18799" to
> > > > “pg_wal/000000010000D45300000010”: File exists
>
> > Hmm. It seems like a race condition betwen StartupXLOG() and
> > RemoveXlogFIle(). We need wider extent of ContolFileLock. Concretely
> > taking ControlFileLock before deciding the target xlog file name in
> > RemoveXlogFile() seems to prevent this happening. (If this is correct
> > this is a live issue on the master branch.)
>
> RemoveXlogFile() calls InstallXLogFileSegment() with find_free=true. The
> intent of find_free=true is to make it okay to pass a target xlog file that
> ceases to be a good target. (InstallXLogFileSegment() searches for a good
> target while holding ControlFileLock.) Can you say more about how that proved
> to be insufficient?

Ug.. No. I can't. I was confused by something. Sorry.

PreallocXlogFiles() and checkpointer are mutually excluded by the same
lock, too.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-08-03 08:23:49 Re: [doc] fix a potential grammer mistake
Previous Message Dilip Kumar 2022-08-03 08:11:30 Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints