Make pg_checksums complain if compiled BLCKSZ and data folder's block size differ
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Cc: Magnus Hagander <magnus@hagander.net>, Michael Banck <michael.banck@credativ.de>, Sergei Kornilov <sk@zsrv.org>
Date: 2019-03-16T01:21:47Z
Lists: pgsql-hackers
Attachments
- checksums-blcksz-error.patch (text/x-diff) patch
Hi all,
(related folks in CC)
Sergei Kornilov has reported here an issue with pg_checksums:
https://www.postgresql.org/message-id/5217311552474471@myt2-66bcb87429e6.qloud-c.yandex.net
If the block size the tool is compiled with does not match the data
folder block size, then users would get incorrect checksums failures,
which is confusing. As pg_checksum_block() uses directly the block
size, this cannot really be made dynamic yet, so we had better issue
an error on that. Michael Banck has sent a patch for that:
https://www.postgresql.org/message-id/1552476561.4947.67.camel@credativ.de
The error message proposed is like that:
+ if (ControlFile->blcksz != BLCKSZ)
+ {
+ fprintf(stderr, _("%s: data directory block size %d is different to compiled-in block size %d.\n"),
+ progname, ControlFile->blcksz, BLCKSZ);
+ exit(1);
+ }
Still I think that we could do better.
Here is a proposal of message which looks more natural to me, and more
consistent with what xlog.c complains about:
database files are incompatible with pg_checksums.
The database cluster was initialized with BLCKSZ %d, but pg_checksums
was compiled with BLCKSZ %d.
Has somebody a better wording for that? Attached is a proposal of
patch.
--
Michael
Commits
-
Error out in pg_verify_checksums on incompatible block size
- 5864d246099f 11.3 landed
-
Error out in pg_checksums on incompatible block size
- fa3395659561 12.0 landed