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

Commit d3e5728

Browse files
committed
In log_newpage_range(), heed forkNum and page_std arguments.
The function assumed forkNum=MAIN_FORKNUM and page_std=true, ignoring the actual arguments. Existing callers passed exactly those values, so there's no live bug. Back-patch to v12, where the function first appeared, because another fix needs this. Discussion: https://postgr.es/m/20191118045434.GA1173436@rfd.leadboat.com
1 parent e629a01 commit d3e5728

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/backend/access/transam/xloginsert.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1043,8 +1043,13 @@ log_newpage_range(Relation rel, ForkNumber forkNum,
10431043
BlockNumber startblk, BlockNumber endblk,
10441044
bool page_std)
10451045
{
1046+
int flags;
10461047
BlockNumber blkno;
10471048

1049+
flags = REGBUF_FORCE_IMAGE;
1050+
if (page_std)
1051+
flags |= REGBUF_STANDARD;
1052+
10481053
/*
10491054
* Iterate over all the pages in the range. They are collected into
10501055
* batches of XLR_MAX_BLOCK_ID pages, and a single WAL-record is written
@@ -1066,7 +1071,8 @@ log_newpage_range(Relation rel, ForkNumber forkNum,
10661071
nbufs = 0;
10671072
while (nbufs < XLR_MAX_BLOCK_ID && blkno < endblk)
10681073
{
1069-
Buffer buf = ReadBuffer(rel, blkno);
1074+
Buffer buf = ReadBufferExtended(rel, forkNum, blkno,
1075+
RBM_NORMAL, NULL);
10701076

10711077
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
10721078

@@ -1088,7 +1094,7 @@ log_newpage_range(Relation rel, ForkNumber forkNum,
10881094
START_CRIT_SECTION();
10891095
for (i = 0; i < nbufs; i++)
10901096
{
1091-
XLogRegisterBuffer(i, bufpack[i], REGBUF_FORCE_IMAGE | REGBUF_STANDARD);
1097+
XLogRegisterBuffer(i, bufpack[i], flags);
10921098
MarkBufferDirty(bufpack[i]);
10931099
}
10941100

0 commit comments

Comments
 (0)