Re: Online enabling of checksums

From: Michael Banck <michael(dot)banck(at)credativ(dot)de>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Greg Stark <stark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: Online enabling of checksums
Date: 2018-03-04 14:24:18
Message-ID: 20180304142418.GF13784@nighthawk.caipicrew.dd-dns.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sat, Mar 03, 2018 at 07:23:31PM +0100, Magnus Hagander wrote:
> diff --git a/src/bin/pg_verify_checksums/pg_verify_checksums.c b/src/bin/pg_verify_checksums/pg_verify_checksums.c
> new file mode 100644
> index 0000000000..a4bfe7284d
> --- /dev/null
> +++ b/src/bin/pg_verify_checksums/pg_verify_checksums.c
> @@ -0,0 +1,308 @@
[...]

> +/*
> + * pg_verify_checksums
> + *
> + * Verifies page level checksums in an offline cluster
> + *
> + * Copyright (c) 2010-2018, PostgreSQL Global Development Group

Weird copyright statement for a new file, did you base it off another
one, or just copy-pasted the boilerplate?

[...]

> + csum = pg_checksum_page(buf, blockno + segmentno*RELSEG_SIZE);
> + if (csum != header->pd_checksum)
> + {
> + if (ControlFile->data_checksum_version == PG_DATA_CHECKSUM_VERSION)
> + fprintf(stderr, _("%s: %s, block %d, invalid checksum in file %X, calculated %X\n"),
> + progname, fn, blockno, header->pd_checksum, csum);

The error message sounds a bit strange to me, I would expect the
filename after "in file [...]", but you print the expected checksum.
Also, 'invalid' sounds a bit like we found something which is malformed
checksum (no hex), so maybe "checksum mismatch in file, expected %X,
found %X" or something?

Michael

--
Michael Banck
Projektleiter / Senior Berater
Tel.: +49 2166 9901-171
Fax: +49 2166 9901-100
Email: michael(dot)banck(at)credativ(dot)de

credativ GmbH, HRB Mönchengladbach 12080
USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2018-03-04 14:49:18 Re: [PATCH] Verify Checksums during Basebackups
Previous Message David Rowley 2018-03-04 14:02:22 Re: [HACKERS] Removing useless DISTINCT clauses