Re: Race between KeepFileRestoredFromArchive() and restartpoint
Noah Misch <noah@leadboat.com>
From: Noah Misch <noah@leadboat.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: don@seiler.us, david@pgmasters.net, pgsql-hackers@postgresql.org
Date: 2022-08-03T07:28:47Z
Lists: pgsql-hackers
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@seiler.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?
Commits
-
Skip WAL recycling and preallocation during archive recovery.
- a5b0c06daae9 13.21 landed
- 014a508009df 14.18 landed
- cc2c7d65fc27 15.0 landed
-
Don't ERROR on PreallocXlogFiles() race condition.
- cbed472a9341 13.21 landed
- 675b771ca5f2 14.18 landed
- 2b3e4672f760 15.0 landed
-
Remove XLogFileInit() ability to unlink a pre-existing file.
- d0b6acaf04a2 13.21 landed
- b494640e8297 14.18 landed
- 421484f79c0b 15.0 landed
-
In XLogFileInit(), fix *use_existent postcondition to suit callers.
- 20e5ef3ca70c 13.21 landed
- 8967dddf086e 14.18 landed
- 85656bc3050f 15.0 landed
-
Remove XLogFileInit() ability to skip ControlFileLock.
- df8ec9634ccd 13.21 landed
- 6b168c1299c5 14.18 landed
- c53c6b98d38a 15.0 landed
-
Add HINT for restartpoint race with KeepFileRestoredFromArchive().
- cf86fddc1c92 11.17 landed
- 41f613fc257c 12.12 landed
- 2ffcb7dce806 10.22 landed
- ad8ebcfe9662 13.8 landed
- 8ad6c5dbbe5a 14.5 landed
-
Complete TODO item:
- 63653f7ffaba 7.3.1 cited