srcBuf = ReadBufferWithoutRelcache(src->rd_locator, forkNum, blkno,
RBM_NORMAL, bstrategy_src,
permanent);
+ LockBuffer(srcBuf, BUFFER_LOCK_SHARE);
srcPage = BufferGetPage(srcBuf);
- if (PageIsNew(srcPage) || PageIsEmpty(srcPage))
- {
- ReleaseBuffer(srcBuf);
- continue;
- }
/* Use P_NEW to extend the destination relation. */
dstBuf = ReadBufferWithoutRelcache(dst->rd_locator, forkNum, P_NEW,
RBM_NORMAL, bstrategy_dst,
permanent);
LockBuffer(dstBuf, BUFFER_LOCK_EXCLUSIVE);
+ dstPage = BufferGetPage(dstBuf);
START_CRIT_SECTION();
/* Copy page data from the source to the destination. */
- dstPage = BufferGetPage(dstBuf);
memcpy(dstPage, srcPage, BLCKSZ);
MarkBufferDirty(dstBuf);
END_CRIT_SECTION();
UnlockReleaseBuffer(dstBuf);
- ReleaseBuffer(srcBuf);
+ UnlockReleaseBuffer(srcBuf);
}
}