Commit 40282224 authored by Alvaro Herrera's avatar Alvaro Herrera

Fix BRIN xlog replay

There was a confusion about which block number to use when storing an
item's pointer in the revmap -- the revmap page's blkno was being used,
not the data page's blkno.

Spotted-by: Jeff Janes
parent 7c02d48e
......@@ -47,6 +47,7 @@ brin_xlog_insert_update(XLogReaderState *record,
{
XLogRecPtr lsn = record->EndRecPtr;
Buffer buffer;
BlockNumber regpgno;
Page page;
XLogRedoAction action;
......@@ -66,6 +67,9 @@ brin_xlog_insert_update(XLogReaderState *record,
action = XLogReadBufferForRedo(record, 0, &buffer);
}
/* need this page's blkno to store in revmap */
regpgno = BufferGetBlockNumber(buffer);
/* insert the index item into the page */
if (action == BLK_NEEDS_REDO)
{
......@@ -97,9 +101,8 @@ brin_xlog_insert_update(XLogReaderState *record,
if (action == BLK_NEEDS_REDO)
{
ItemPointerData tid;
BlockNumber blkno = BufferGetBlockNumber(buffer);
ItemPointerSet(&tid, blkno, xlrec->offnum);
ItemPointerSet(&tid, regpgno, xlrec->offnum);
page = (Page) BufferGetPage(buffer);
brinSetHeapBlockItemptr(buffer, xlrec->pagesPerRange, xlrec->heapBlk,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment