Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4028222

Browse files
committed
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
1 parent 7c02d48 commit 4028222

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/access/brin/brin_xlog.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ brin_xlog_insert_update(XLogReaderState *record,
4747
{
4848
XLogRecPtr lsn = record->EndRecPtr;
4949
Buffer buffer;
50+
BlockNumber regpgno;
5051
Page page;
5152
XLogRedoAction action;
5253

@@ -66,6 +67,9 @@ brin_xlog_insert_update(XLogReaderState *record,
6667
action = XLogReadBufferForRedo(record, 0, &buffer);
6768
}
6869

70+
/* need this page's blkno to store in revmap */
71+
regpgno = BufferGetBlockNumber(buffer);
72+
6973
/* insert the index item into the page */
7074
if (action == BLK_NEEDS_REDO)
7175
{
@@ -97,9 +101,8 @@ brin_xlog_insert_update(XLogReaderState *record,
97101
if (action == BLK_NEEDS_REDO)
98102
{
99103
ItemPointerData tid;
100-
BlockNumber blkno = BufferGetBlockNumber(buffer);
101104

102-
ItemPointerSet(&tid, blkno, xlrec->offnum);
105+
ItemPointerSet(&tid, regpgno, xlrec->offnum);
103106
page = (Page) BufferGetPage(buffer);
104107

105108
brinSetHeapBlockItemptr(buffer, xlrec->pagesPerRange, xlrec->heapBlk,

0 commit comments

Comments
 (0)