Re: odd buildfarm failure - "pg_ctl: control file appears to be corrupt"

David Steele <david@pgmasters.net>

From: David Steele <david@pgmasters.net>
To: Michael Paquier <michael@paquier.xyz>, Thomas Munro <thomas.munro@gmail.com>
Cc: Stephen Frost <sfrost@snowman.net>, Daniel Gustafsson <daniel@yesql.se>, "Anton A. Melnikov" <aamelnikov@inbox.ru>, Tom Lane <tgl@sss.pgh.pa.us>, Andres Freund <andres@anarazel.de>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2023-10-12T14:41:39Z
Lists: pgsql-hackers
On 10/12/23 09:58, David Steele wrote:
>> On Thu, Oct 12, 2023 at 12:25:34PM +1300, Thomas Munro wrote:
>>> I'm planning to push 0002 (retries in frontend programs, which is
>>> where this thread began) and 0004 (add missing locks to SQL
>>> functions), including back-patches as far as 12, in a day or so.
>>>
>>> I'll abandon the others for now, since we're now thinking bigger[1]
>>> for backups, side stepping the problem.
>>
>> FWIW, 0003 looks like a low-risk improvement seen from here, so I'd be
>> OK to use it at least for now on HEAD before seeing where the other
>> discussions lead.  0004 would be OK if applied to v11, as well, but I
>> also agree that it is not a big deal to let this branch be as it is
>> now at this stage if you feel strongly this way.
> 
> Agreed on 0002 and 0004, though I don't really think a back patch of 
> 0004 to 11 is necessary. I'd feel differently if there was a single 
> field report of this issue.
> 
> I would prefer to hold off on applying 0003 to HEAD until we see how [1] 
> pans out.
> 
> Having said that, I have a hard time seeing [1] as being something we 
> could back patch. The manipulation of backup_label is simple enough, but 
> starting a cluster without pg_control is definitely going to change some 
> things. Also, the requirement that backup software skip copying 
> pg_control after a minor release is not OK.
> 

After some more thought, I think we could massage the "pg_control in 
backup_label" method into something that could be back patched, with 
more advanced features (e.g. error on backup_label and pg_control both 
present on initial cluster start) saved for HEAD.

Regards,
-David



Commits

  1. Try to handle torn reads of pg_control in frontend.

  2. Acquire ControlFileLock in relevant SQL functions.