Re: Online enabling of checksums

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Michael Banck <michael(dot)banck(at)credativ(dot)de>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, 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>
Subject: Re: Online enabling of checksums
Date: 2018-03-04 22:30:26
Message-ID: 51DF4F54-4295-47DF-B7FD-21FF2EB2BA58@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 04 Mar 2018, at 15:24, Michael Banck <michael(dot)banck(at)credativ(dot)de> wrote:

>> + 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?

Agreed. Looking at our current error messages, “in file” is conventionally
followed by the filename. I do however think “calculated” is better than
“expected” since it conveys clearly that the compared checksum is calculated by
pg_verify_checksum and not read from somewhere.

How about something like this?

_(“%s: checksum mismatch in file \”%s\”, block %d: calculated %X, found %X”),
progname, fn, blockno, csum, header->pd_checksum);

cheers ./daniel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Gould 2018-03-04 23:18:57 Re: [patch] BUG #15005: ANALYZE can make pg_class.reltuples inaccurate.
Previous Message Fabiano Machado Dias 2018-03-04 22:27:39 34