diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 0a05577b68..95212a3941 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -3833,11 +3833,9 @@ RelationCopyStorageUsingBuffer(RelFileLocator srclocator, LockBuffer(srcBuf, BUFFER_LOCK_SHARE); srcPage = BufferGetPage(srcBuf); - /* Use P_NEW to extend the destination relation. */ dstBuf = ReadBufferWithoutRelcache(dstlocator, forkNum, blkno, - RBM_NORMAL, bstrategy_dst, + RBM_ZERO_AND_LOCK, bstrategy_dst, permanent); - LockBuffer(dstBuf, BUFFER_LOCK_EXCLUSIVE); dstPage = BufferGetPage(dstBuf); START_CRIT_SECTION(); @@ -3855,6 +3853,9 @@ RelationCopyStorageUsingBuffer(RelFileLocator srclocator, UnlockReleaseBuffer(dstBuf); UnlockReleaseBuffer(srcBuf); } + + FreeAccessStrategy(bstrategy_src); + FreeAccessStrategy(bstrategy_dst); } /* ---------------------------------------------------------------------