Missing pg_control crashes postmaster

From: Brian Faherty <anothergenericuser(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Missing pg_control crashes postmaster
Date: 2018-07-23 19:31:13
Message-ID: CAMLsqiTaao_RZa=yjHA_UTrvifYPAikoHdLROO_p=bXLM0OK6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-Create-pg_control-on-update-if-not-exists.patch text/x-patch 903 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2018-07-23 19:49:33 Re: Missing pg_control crashes postmaster
Previous Message Nico Williams 2018-07-23 19:27:50 Re: How can we submit code patches that implement our (pending) patents?