pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_controldata: Prevent division-by-zero errors
Date: Wed, 21 Mar 2018 16:21:47 +0000
Message-ID: <E1eygUl-0001da-LG@gemulon.postgresql.org> (raw)

pg_controldata: Prevent division-by-zero errors

If the control file is corrupted and specifies the WAL segment size
to be 0 bytes, calculating the latest checkpoint's REDO WAL file
will fail with a division-by-zero error.  Show it as "???" instead.

Also reword the warning message a bit and send it to stdout, like the
other pre-existing warning messages.

Add some tests for dealing with a corrupted pg_control file.

Author: Nathan Bossart <bossartn@amazon.com>, tests by me

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4731d848f23e08a9396b4831d13fbb6dd460faf2

Modified Files
--------------
src/bin/pg_controldata/pg_controldata.c        | 26 ++++++++++++++++++--------
src/bin/pg_controldata/t/001_pg_controldata.pl | 21 ++++++++++++++++++++-
2 files changed, 38 insertions(+), 9 deletions(-)



Message-ID: <E1eygUl-0001da-LG@gemulon.postgresql.org>
Permalink:  ../E1eygUl-0001da-LG@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1eygUl-0001da-LG@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter_e@gmx.net
  Subject: Re: pgsql: pg_controldata: Prevent division-by-zero errors
  In-Reply-To: <E1eygUl-0001da-LG@gemulon.postgresql.org>
  References: <E1eygUl-0001da-LG@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox