Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
During the split, set checksum on an empty hash index page.
authorAmit Kapila <akapila@postgresql.org>
Tue, 4 Sep 2018 03:13:37 +0000 (08:43 +0530)
committerAmit Kapila <akapila@postgresql.org>
Tue, 4 Sep 2018 03:13:37 +0000 (08:43 +0530)
On a split, we allocate a new splitpoint's worth of bucket pages wherein
we initialize the last page with zeros which is fine, but we forgot to set
the checksum for that last page.

We decided to back-patch this fix till 10 because we don't have an easy
way to test it in prior versions.  Another reason is that the hash-index
code is changed heavily in 10, so it is not advisable to push the fix
without testing it in prior versions.

Author: Amit Kapila
Reviewed-by: Yugo Nagata
Backpatch-through: 10
Discussion: https://postgr.es/m/5d03686d-727c-dbf8-0064-bf8b97ffe850@2ndquadrant.com

src/backend/access/hash/hashpage.c

index bbf98de35ac256d02de11bfd172f7ce0d58d3ce2..53adfec4fd844f4687ed01575c4af305a888f6ca 100644 (file)
@@ -1036,6 +1036,7 @@ _hash_alloc_buckets(Relation rel, BlockNumber firstblock, uint32 nblocks)
                    true);
 
    RelationOpenSmgr(rel);
+   PageSetChecksumInplace(page, lastblock);
    smgrextend(rel->rd_smgr, MAIN_FORKNUM, lastblock, zerobuf.data, false);
 
    return true;