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

From Andres Freund
Subject Re: Online verification of checksums
Date
Msg-id 20190330133529.t7chaepvbmi63xbi@alap3.anarazel.de
Whole thread Raw
In response to Re: Online verification of checksums  (Magnus Hagander <magnus@hagander.net>)
List pgsql-hackers
Hi,

On 2019-03-30 12:56:21 +0100, Magnus Hagander wrote:
> > ISTM that the fact that we had to teach it about different segment files
> > for checksum verification by splitting up the filename at "." implies
> > that it is not the correct level of abstraction (but maybe it could get
> > schooled some more about Postgres internals, e.g. by passing it a
> > RefFileNode struct and not a filename).
> >
> 
> But that has to be fixed in pg_basebackup *regardless*, doesn't it? And if
> we fix it there, we only have to fix it once...

I'm not understanding the problem here. We already need to know all of
this? sendFile() determines whether the file is checksummed, and
computes the segment number:

        if (is_checksummed_file(readfilename, filename))
        {
            verify_checksum = true;
...
                    checksum = pg_checksum_page((char *) page, blkno + segmentno * RELSEG_SIZE);
                    phdr = (PageHeader) page;

I agree that the way checksumming works is a bit of a layering
violation. In my opinion it belongs in the smgr level, not bufmgr.c etc,
so different storage methods can store it differently. But that seems
fairly indepedent of this problem.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Magnus Hagander
Date:
Subject: Re: Checksum errors in pg_stat_database
Next
From: Stephen Frost
Date:
Subject: [PATCH v22] GSSAPI encryption support