Use neon_nblocks instead of get_cached_relsize (#3132)

This prevents us from overwriting all blocks of a relation when we
extend the relation without first caching the size - get_cached_relsize
does not guarantee a correct result when it returns `false`.
This commit is contained in:
MMeent
2022-12-16 21:14:57 +01:00
committed by GitHub
parent 83baf49487
commit 3514e6e89a

View File

@@ -1669,7 +1669,7 @@ neon_extend(SMgrRelation reln, ForkNumber forkNum, BlockNumber blkno,
* (leaving holes). But this rule is violated in PG-15 where CreateAndCopyRelationData
* call smgrextend for destination relation n using size of source relation
*/
get_cached_relsize(reln->smgr_rnode.node, forkNum, &n_blocks);
n_blocks = neon_nblocks(reln, forkNum);
while (n_blocks < blkno)
neon_wallog_page(reln, forkNum, n_blocks++, buffer, true);