From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Michael Banck <michael.banck@credativ.de>
Cc: Magnus Hagander <magnus@hagander.net>
Cc: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: pg_verify_checksums and -fno-strict-aliasing
Date: Thu, 30 Aug 2018 18:11:40 -0400
Message-ID: <28544.1535667100@sss.pgh.pa.us> (raw)
In-Reply-To: <20180830220409.4zhdka6ibs66enbk@alap3.anarazel.de>
References: <1535618100.1286.3.camel@credativ.de>
<alpine.DEB.2.21.1808301325070.32764@lancre>
<7321.1535639966@sss.pgh.pa.us>
<CABUevEz+3g4-tKLgcjTNK7EwgHm95NSYSKTNyEjcnQEGRzie0A@mail.gmail.com>
<1535660901.1286.8.camel@credativ.de>
<25968.1535663968@sss.pgh.pa.us>
<20180830214606.xpm4bho5nmhfuzlx@alap3.anarazel.de>
<20180830220409.4zhdka6ibs66enbk@alap3.anarazel.de>
Andres Freund <andres@anarazel.de> writes:
> On 2018-08-30 14:46:06 -0700, Andres Freund wrote:
>> One way to fix it would be to memcpy in/out the modified PageHeader, or
>> just do offset math and memcpy to that offset.
> It took me a bit to reproduce the issue (due to sheer stupidity on my
> part: no, changing the flags passed to gcc to link pg_verify_checksums
> doesn't do the trick), but the above indeed fixes the issue for me.
I suspect people will complain about the added cost of doing that.
I've been AFK all afternoon, but what I was intending to try next was
the union approach, specifically union'ing PageHeaderData with the uint32
array representation needed by pg_checksum_block(). That might also
end up giving us code less unreadable than this:
uint32 (*dataArr)[N_SUMS] = (uint32 (*)[N_SUMS]) data;
BTW, not to mention the elephant in the room, but: is it *really* OK
that pg_checksum_page scribbles on the page buffer, even temporarily?
It's certainly quite horrid that there aren't large warnings about
that in the function's API comment.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, michael.banck@credativ.de, magnus@hagander.net, coelho@cri.ensmp.fr
Subject: Re: pg_verify_checksums and -fno-strict-aliasing
In-Reply-To: <28544.1535667100@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox