Re: [HACKERS] BRIN desummarization writes junk WAL records - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: [HACKERS] BRIN desummarization writes junk WAL records
Date
Msg-id 20170407201603.kzkcboe4cdcp4tm2@alvherre.pgsql
Whole thread Raw
In response to [HACKERS] BRIN desummarization writes junk WAL records  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:

> The proximate cause of the exception seems to be that
> brinSetHeapBlockItemptr is being passed pagesPerRange = 0,
> which is problematic since HEAPBLK_TO_REVMAP_INDEX tries to
> divide by that.  Looking one level down, the bogus value
> seems to be coming out of an xl_brin_desummarize WAL record:
> 
> (gdb) f 1
> #1  0x0000000000478cdc in brin_xlog_desummarize_page (record=0x2403ac8)
>     at brin_xlog.c:274
> 274                     brinSetHeapBlockItemptr(buffer, xlrec->pagesPerRange, xlrec->heapBlk, iptr);
> (gdb) p *xlrec
> $1 = {pagesPerRange = 0, heapBlk = 0, regOffset = 1}
> 
> This is, perhaps, not unrelated to the fact that
> brinRevmapDesummarizeRange doesn't seem to be bothering to fill
> that field of the record.

Absolutely.

> BTW, is it actually sensible that xl_brin_desummarize's heapBlk
> is declared OffsetNumber and not BlockNumber?  If there's a reason
> why that's correct, the field name seems damn misleading.

Nah, just an oversight (against which the compiler doesn't protect.)

Fixed both problems.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] Remaining 2017-03 CF entries
Next
From: Thomas Munro
Date:
Subject: Re: [HACKERS] recent deadlock regression test failures