> On Aug 26, 2021, at 3:03 AM, Peter Eisentraut 
> <peter.eisentr...@enterprisedb.com> wrote:
> 
> 
> Is there a reason why contrib/amcheck/verify_heapam.c does not want to run on 
> sequences?  If I take out the checks, it appears to work.  Is this an 
> oversight?  Or if there is a reason, maybe it could be stated in a comment, 
> at least.

Testing the corruption checking logic on all platforms is a bit arduous, 
because the data layout on disk changes with alignment difference, endianness, 
etc.  The work I did with Tom's help finally got good test coverage across the 
entire buildfarm, but that test (contrib/amcheck/t/001_verify_heapam.pl) 
doesn't work for sequences even on my one platform (mac laptop).

I have added a modicum of test coverage for sequences in the attached WIP 
patch, which is enough to detect sequence corruption on my laptop.  It would 
have to be tested across the buildfarm after being extended to cover more 
cases.  As it stands now, it uses blunt force to corrupt the relation, and only 
verifies that verify_heapam() returns some corruption, not that it reports the 
right corruption.

I understand that sequences are really just heap tables, and since we already 
test corrupted heap tables, we could assume that we already have sufficient 
coverage.  I'm not entirely comfortable with that, though, because future patch 
authors who modify how tables or sequences work are not necessarily going to 
think carefully about whether their modifications invalidate that assumption.

Attachment: v1-0001-WIP-patch-to-support-amcheck-of-sequences.patch.WIP
Description: Binary data

—
Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Reply via email to