pg_control read error message

Started by Magnus Haganderover 8 years ago6 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t38717
psql -h localhost -U postgres

Built from patchset v1 (message #1), July 27, 2026 at 08:27 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t38717_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t38717_1 && git checkout t38717_1

Patchset v1 (message #1) is on t38717_1

Jump to latest
#1Magnus Hagander
magnus@hagander.net

If pg_control is for some reason empty, we give an error messagfe like:

2018-05-18 13:24:03.342 CEST [19697] PANIC: could not read from control
file: Success

Which is, uh, wrong -- it's definitely not successful.

Obviously this is a state where the user is fairly screwed anyway, but we
should give a better message.

Attached is a patch that does this. Reasonable?

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

Attachments:

t38717_1
pg_control_error.patchtext/x-patch; charset=US-ASCII; name=pg_control_error.patchDownload+12-4
#2Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Magnus Hagander (#1)
Re: pg_control read error message

On 18/05/18 14:32, Magnus Hagander wrote:

If pg_control is for some reason empty, we give an error messagfe like:

2018-05-18 13:24:03.342 CEST [19697] PANIC: could not read from control
file: Success

Which is, uh, wrong -- it's definitely not successful.

Obviously this is a state where the user is fairly screwed anyway, but we
should give a better message.

Attached is a patch that does this. Reasonable?

Looks good to me.

- Heikki

#3Michael Paquier
michael@paquier.xyz
In reply to: Heikki Linnakangas (#2)
Re: pg_control read error message

On Fri, May 18, 2018 at 03:54:47PM +0300, Heikki Linnakangas wrote:

Looks good to me.

+1 for fixing that.  get_controlfile() in controldata_utils.c also needs
to be fixed.
--
Michael
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Heikki Linnakangas (#2)
Re: pg_control read error message

Heikki Linnakangas <hlinnaka@iki.fi> writes:

On 18/05/18 14:32, Magnus Hagander wrote:

If pg_control is for some reason empty, we give an error messagfe like:
2018-05-18 13:24:03.342 CEST [19697] PANIC: could not read from control
file: Success
Which is, uh, wrong -- it's definitely not successful.
Obviously this is a state where the user is fairly screwed anyway, but we
should give a better message.
Attached is a patch that does this. Reasonable?

Looks good to me.

Only comment I have is that I think there's similar shortcuts in a lot
of places :-(

regards, tom lane

#5Magnus Hagander
magnus@hagander.net
In reply to: Michael Paquier (#3)
Re: pg_control read error message

On Fri, May 18, 2018 at 4:02 PM, Michael Paquier <michael@paquier.xyz>
wrote:

On Fri, May 18, 2018 at 03:54:47PM +0300, Heikki Linnakangas wrote:

Looks good to me.

+1 for fixing that. get_controlfile() in controldata_utils.c also needs
to be fixed.

Pushed a fix including the controldata_utils.c one.

Per Toms comments we probably have more of these, but that's no excuse not
to fix this one :)

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/&gt;
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/&gt;

#6Michael Paquier
michael@paquier.xyz
In reply to: Tom Lane (#4)
Re: pg_control read error message

On Fri, May 18, 2018 at 10:22:29AM -0400, Tom Lane wrote:

Only comment I have is that I think there's similar shortcuts in a lot
of places :-(

Yeah. A quick lookup is showing me one in xlog.c (XLOG_BLCKSZ) and one
in pg_rewind. (Spotted roughly 392 places to look at in all the core
code). Let's discuss that on a separate thread.
--
Michael