Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita590f26

Browse files
committed
BRIN: fix bug in xlog backup block counting
The code that generates the BRIN_XLOG_UPDATE removes the bufferreference when the page that's target for the updated tuple is freshlyinitialized. This is a pretty usual optimization, but was breaking thecase where the revmap buffer, which is referenced in the same WALrecord, is getting a backup block: the replay code was using backupblock index 1, which is not valid when the update target buffer getspruned; the revmap buffer gets assigned 0 instead. Make sure to use thecorrect backup block index for revmap when replaying.Bug reported by Fujii Masao.
1 parentc8df947 commita590f26

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/backend/access/brin/brin_xlog.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,11 @@ brin_xlog_insert_update(XLogRecPtr lsn, XLogRecord *record,
6060
*/
6161
if (record->xl_info&XLOG_BRIN_INIT_PAGE)
6262
{
63-
XLogReadBufferForRedoExtended(lsn,record,0,
64-
xlrec->node,MAIN_FORKNUM,blkno,
65-
RBM_ZERO, false,&buffer);
63+
/*
64+
* No full-page image here. Don't try to read it, because there
65+
* might be one for the revmap buffer, below.
66+
*/
67+
buffer=XLogReadBuffer(xlrec->node,blkno, true);
6668
page=BufferGetPage(buffer);
6769
brin_page_init(page,BRIN_PAGETYPE_REGULAR);
6870
action=BLK_NEEDS_REDO;
@@ -97,7 +99,9 @@ brin_xlog_insert_update(XLogRecPtr lsn, XLogRecord *record,
9799
UnlockReleaseBuffer(buffer);
98100

99101
/* update the revmap */
100-
action=XLogReadBufferForRedo(lsn,record,1,xlrec->node,
102+
action=XLogReadBufferForRedo(lsn,record,
103+
record->xl_info&XLOG_BRIN_INIT_PAGE ?0 :1,
104+
xlrec->node,
101105
xlrec->revmapBlk,&buffer);
102106
if (action==BLK_NEEDS_REDO)
103107
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp