Re: odd buildfarm failure - "pg_ctl: control file appears to be corrupt"
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers@postgresql.org
Date: 2022-11-23T22:05:03Z
Lists: pgsql-hackers
Thomas Munro <thomas.munro@gmail.com> writes: > On Wed, Nov 23, 2022 at 11:03 PM Thomas Munro <thomas.munro@gmail.com> wrote: >> I assume this is ext4. Presumably anything that reads the >> controlfile, like pg_ctl, pg_checksums, pg_resetwal, >> pg_control_system(), ... by reading without interlocking against >> writes could see garbage. I have lost track of the versions and the >> thread, but I worked out at some point by experimentation that this >> only started relatively recently for concurrent read() and write(), >> but always happened with concurrent pread() and pwrite(). The control >> file uses the non-p variants which didn't mash old/new data like >> grated cheese under concurrency due to some implementation detail, but >> now does. Ugh. > As for what to do about it, some ideas: > 2. Retry after a short time on checksum failure. The probability is > already miniscule, and becomes pretty close to 0 if we read thrice > 100ms apart. > First thought is that 2 is appropriate level of complexity for this > rare and stupid problem. Yeah, I was thinking the same. A variant could be "repeat until we see the same calculated checksum twice". regards, tom lane
Commits
-
Try to handle torn reads of pg_control in frontend.
- 63a582222c6b 17.0 landed
- 43c979086825 12.17 landed
- 67060be3df34 13.13 landed
- dc75748a918e 14.10 landed
- 5e39884d322a 15.5 landed
- 5725e4ebe7a9 16.1 landed
-
Acquire ControlFileLock in relevant SQL functions.
- f1634c968101 11.22 landed
- 637e86ecc5e4 12.17 landed
- ae9da357bd6d 13.13 landed
- a56fe5cf07fe 14.10 landed
- 606be8a35d97 15.5 landed
- 2371432cd6b9 16.1 landed
- c558e6fd92ff 17.0 landed