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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers