Missing pg_control crashes postmaster - Mailing list pgsql-hackers

From Brian Faherty
Subject Missing pg_control crashes postmaster
Date
Msg-id CAMLsqiTaao_RZa=yjHA_UTrvifYPAikoHdLROO_p=bXLM0OK6A@mail.gmail.com
Whole thread Raw
Responses Re: Missing pg_control crashes postmaster  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Missing pg_control crashes postmaster  (Andres Freund <andres@anarazel.de>)
Re: Missing pg_control crashes postmaster  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Missing pg_control crashes postmaster  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-hackers
Hey Hackers,

If a postmaster is running and the pg_control file is removed postgres
will PANIC.

Steps to recreate:

1.) start a new cluster
2.) rm $DATADIR/pg_control
3.) psql => CHECKPOINT;

PANIC:  could not open control file "global/pg_control": No such file
or directory

After the PANIC there is no pg_control. Recovery would be difficult
without a replica or a backup. Instead of crashing we can just write a
new pg_control file since all the data is in memory at the time.

There does not really seem to be a need for this behavior as all the
information postgres needs is in memory at this point. I propose with
a patch to just recreate pg_control on updates if it does not exist.

-- 
Brian Faherty

Attachment

pgsql-hackers by date:

Previous
From: Nico Williams
Date:
Subject: Re: How can we submit code patches that implement our (pending)patents?
Next
From: "David G. Johnston"
Date:
Subject: Re: Missing pg_control crashes postmaster