summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2021-06-08 17:24:27 +0000
committerTomas Vondra2021-06-08 17:33:11 +0000
commitd1f0aa7696917213485c03b076b573497a535076 (patch)
treea867496ac9b072ca5bf5f6924a3ab00314c84426
parentbfeede9fa464ab707eb5ac5704742bf78bd7ac9e (diff)
Fix pg_visibility regression failure with CLOBBER_CACHE_ALWAYS
Commit 8e03eb92e9 reverted a bit too much code, reintroducing one of the issues fixed by 39b66a91bd - a page might have been left partially empty after relcache invalidation. Reported-By: Tom Lane Author: Masahiko Sawada Discussion: https://postgr.es/m/[email protected] Discussion: https://postgr.es/m/CAD21AoA%3D%3Df2VSw3c-Cp_y%3DWLKHMKc1D6s7g3YWsCOvgaYPpJcg%40mail.gmail.com
-rw-r--r--src/backend/access/heap/hio.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/backend/access/heap/hio.c b/src/backend/access/heap/hio.c
index c47c7522ca6..ffc89685bff 100644
--- a/src/backend/access/heap/hio.c
+++ b/src/backend/access/heap/hio.c
@@ -407,19 +407,19 @@ RelationGetBufferForTuple(Relation relation, Size len,
* target.
*/
targetBlock = GetPageWithFreeSpace(relation, targetFreeSpace);
+ }
- /*
- * If the FSM knows nothing of the rel, try the last page before we
- * give up and extend. This avoids one-tuple-per-page syndrome during
- * bootstrapping or in a recently-started system.
- */
- if (targetBlock == InvalidBlockNumber)
- {
- BlockNumber nblocks = RelationGetNumberOfBlocks(relation);
+ /*
+ * If the FSM knows nothing of the rel, try the last page before we
+ * give up and extend. This avoids one-tuple-per-page syndrome during
+ * bootstrapping or in a recently-started system.
+ */
+ if (targetBlock == InvalidBlockNumber)
+ {
+ BlockNumber nblocks = RelationGetNumberOfBlocks(relation);
- if (nblocks > 0)
- targetBlock = nblocks - 1;
- }
+ if (nblocks > 0)
+ targetBlock = nblocks - 1;
}
loop: