Skip to content

Commit d1f0aa7

Browse files
committed
Fix pg_visibility regression failure with CLOBBER_CACHE_ALWAYS
Commit 8e03eb9 reverted a bit too much code, reintroducing one of the issues fixed by 39b66a9 - a page might have been left partially empty after relcache invalidation. Reported-By: Tom Lane Author: Masahiko Sawada Discussion: https://postgr.es/m/822752.1623032114@sss.pgh.pa.us Discussion: https://postgr.es/m/CAD21AoA%3D%3Df2VSw3c-Cp_y%3DWLKHMKc1D6s7g3YWsCOvgaYPpJcg%40mail.gmail.com
1 parent bfeede9 commit d1f0aa7

File tree

1 file changed

+11
-11
lines changed
  • src/backend/access/heap

1 file changed

+11
-11
lines changed

src/backend/access/heap/hio.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -407,19 +407,19 @@ RelationGetBufferForTuple(Relation relation, Size len,
407407
* target.
408408
*/
409409
targetBlock = GetPageWithFreeSpace(relation, targetFreeSpace);
410+
}
410411

411-
/*
412-
* If the FSM knows nothing of the rel, try the last page before we
413-
* give up and extend. This avoids one-tuple-per-page syndrome during
414-
* bootstrapping or in a recently-started system.
415-
*/
416-
if (targetBlock == InvalidBlockNumber)
417-
{
418-
BlockNumber nblocks = RelationGetNumberOfBlocks(relation);
412+
/*
413+
* If the FSM knows nothing of the rel, try the last page before we
414+
* give up and extend. This avoids one-tuple-per-page syndrome during
415+
* bootstrapping or in a recently-started system.
416+
*/
417+
if (targetBlock == InvalidBlockNumber)
418+
{
419+
BlockNumber nblocks = RelationGetNumberOfBlocks(relation);
419420

420-
if (nblocks > 0)
421-
targetBlock = nblocks - 1;
422-
}
421+
if (nblocks > 0)
422+
targetBlock = nblocks - 1;
423423
}
424424

425425
loop:

0 commit comments

Comments
 (0)