Re: Race between KeepFileRestoredFromArchive() and restartpoint
David Steele <david@pgmasters.net>
From: David Steele <david@pgmasters.net>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>, noah@leadboat.com
Cc: pgsql-hackers@postgresql.org, don@seiler.us
Date: 2022-08-04T10:32:38Z
Lists: pgsql-hackers
On 8/4/22 04:06, Kyotaro Horiguchi wrote: > At Wed, 3 Aug 2022 23:24:56 -0700, Noah Misch <noah@leadboat.com> wrote in >>>> I think in this case a HINT might be sufficient to at least keep people from >>>> wasting time tracking down a problem that has already been fixed. >> >> Here's a patch to add that HINT. I figure it's better to do this before next >> week's minor releases. In the absence of objections, I'll push this around >> 2022-08-05 14:00 UTC. > > +1 Looks good to me as well. >>>> However, there is another issue [1] that might argue for a back patch if >>>> this patch (as I believe) would fix the issue. >>> >>>> [1] https://www.postgresql.org/message-id/CAHJZqBDxWfcd53jm0bFttuqpK3jV2YKWx%3D4W7KxNB4zzt%2B%2BqFg%40mail.gmail.com >>> >>> That makes sense. Each iteration of the restartpoint recycle loop has a 1/N >>> chance of failing. Recovery adds >N files between restartpoints. Hence, the >>> WAL directory grows without bound. Is that roughly the theory in mind? >> >> On further reflection, I don't expect it to happen that way. Each failure >> message is LOG-level, so the remaining recycles still happen. (The race >> condition can yield an ERROR under PreallocXlogFiles(), but recycling is >> already done at that point.) > > I agree to this. Hmmm, OK. We certainly have a fairly serious issue here, i.e. pg_wal growing without bound. Even if we are not sure what is causing it, how confident are we that the patches applied to v15 would fix it? Regards, -David
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