]> granicus.if.org Git - postgresql/commitdiff
Fix new BRIN desummarize WAL record
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 7 Apr 2017 19:58:54 +0000 (16:58 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 7 Apr 2017 20:11:56 +0000 (17:11 -0300)
The WAL-writing piece was forgetting to set the pages-per-range value.
Also, fix the declared type of struct member heapBlk, which I mistakenly
set as OffsetNumber rather than BlockNumber.

Problem was introduced by commit c655899ba9ae (April 1st).  Any system
that tries to replay the new WAL record written before this fix is
likely to die on replay and require pg_resetwal.

Reported by Tom Lane.
Discussion: https://postgr.es/m/20191.1491524824@sss.pgh.pa.us

src/backend/access/brin/brin_revmap.c
src/include/access/brin_xlog.h

index 35e53a2bac27ca2b35bf51ea928f1530cfea6937..9ed279bf42fa2b8ac1f4fee151f63ef766c3d5ff 100644 (file)
@@ -417,6 +417,7 @@ brinRevmapDesummarizeRange(Relation idxrel, BlockNumber heapBlk)
                xl_brin_desummarize xlrec;
                XLogRecPtr              recptr;
 
+               xlrec.pagesPerRange = revmap->rm_pagesPerRange;
                xlrec.heapBlk = heapBlk;
                xlrec.regOffset = regOffset;
 
index 89ed334a018bcba81041c6709980eeef20f0ff57..e08f9d73025b47547ce997d91b6f1e3c9255bda4 100644 (file)
@@ -134,7 +134,7 @@ typedef struct xl_brin_desummarize
 {
        BlockNumber     pagesPerRange;
        /* page number location to set to invalid */
-       OffsetNumber heapBlk;
+       BlockNumber heapBlk;
        /* offset of item to delete in regular index page */
        OffsetNumber regOffset;
 } xl_brin_desummarize;