From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Stephen Frost <sfrost@snowman.net>
Cc: Edson Carlos Ericksson Richter <richter@simkorp.com.br>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Does PostgreSQL check database integrity at startup?
Date: Wed, 27 Dec 2017 17:11:16 -0300
Message-ID: <20171227201116.bl23m2g3hr6y2wlw@alvherre.pgsql> (raw)
In-Reply-To: <20171227170213.GW4628@tamriel.snowman.net>
Stephen Frost wrote:
> It's entirely unclear to me what the problem being complained about in
> this thread actually is.
As Edson explained, a relfilenode in the standby server is zero bytes
long when it is not that size in the primary server, and it corresponds
to a persistent table. I don't have any satisfactory explanation for
that.
> Given the thread subject, if someone actually wanted to do a database
> integrity check before startup, they could use pgBackRest to perform a
> backup with a CRC-enabled database and at least verify that all of the
> checksums are valid.
That's not a complete solution, because a zero-byte file does not
contain any CRC. CRCs may detect some problems, but they will not
detect this particular kind of corruption.
> We could possibly look into adding some set of additional checks for
> files which can't actually be zero-byte, perhaps.. I know we have some
> other one-off checks already.
Some possibilities, from the realm of haven't-had-coffee-yet-after-lunch:
* the length of the FSM fork can let you infer something about the
length that the main fork ought to have. Maybe the VM fork too? not sure.
(Easy to check: just some math on the size of the FSM/VM forks)
* the largest block number in any item pointer in any index of a table
can tell you what's the latest page that should appear in the table.
(Expensive: need to scan the indexes completely)
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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-general@postgresql.org
Cc: alvherre@alvh.no-ip.org, sfrost@snowman.net, richter@simkorp.com.br
Subject: Re: Does PostgreSQL check database integrity at startup?
In-Reply-To: <20171227201116.bl23m2g3hr6y2wlw@alvherre.pgsql>
References: <20171227170213.GW4628@tamriel.snowman.net> <20171227201116.bl23m2g3hr6y2wlw@alvherre.pgsql>
* 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