Re: Online enabling of checksums - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: Online enabling of checksums
Date
Msg-id 51DF4F54-4295-47DF-B7FD-21FF2EB2BA58@yesql.se
Whole thread Raw
In response to Re: Online enabling of checksums  (Michael Banck <michael.banck@credativ.de>)
Responses Re: Online enabling of checksums  (Michael Banck <michael.banck@credativ.de>)
List pgsql-hackers
> On 04 Mar 2018, at 15:24, Michael Banck <michael.banck@credativ.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

pgsql-hackers by date:

Previous
From: Fabiano Machado Dias
Date:
Subject: 34
Next
From: David Gould
Date:
Subject: Re: [patch] BUG #15005: ANALYZE can make pg_class.reltuplesinaccurate.