Skip to content

Commit 708f67c

Browse files
committed
Blowaway relation buffers from buffer pool before truncation.
1 parent 94e52d3 commit 708f67c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/backend/commands/vacuum.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.47 1997/09/12 04:07:30 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.48 1997/09/22 07:12:33 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -56,6 +56,8 @@
5656

5757
#include <port-protos.h>
5858

59+
extern int BlowawayRelationBuffers(Relation rdesc, BlockNumber block);
60+
5961
bool VacuumRunning = false;
6062

6163
static Portal vc_portal;
@@ -1394,6 +1396,9 @@ Elapsed %u/%u sec.",
13941396
/* truncate relation */
13951397
if (blkno < nblocks)
13961398
{
1399+
i = BlowawayRelationBuffers(onerel, blkno);
1400+
if (i < 0)
1401+
elog (FATAL, "VACUUM (vc_rpfheap): BlowawayRelationBuffers returned %d", i);
13971402
blkno = smgrtruncate(onerel->rd_rel->relsmgr, onerel, blkno);
13981403
Assert(blkno >= 0);
13991404
vacrelstats->npages = blkno; /* set new number of blocks */
@@ -1465,6 +1470,10 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList Vvpl)
14651470
* it) before truncation
14661471
*/
14671472
FlushBufferPool(!TransactionFlushEnabled());
1473+
1474+
i = BlowawayRelationBuffers(onerel, nblocks);
1475+
if (i < 0)
1476+
elog (FATAL, "VACUUM (vc_vacheap): BlowawayRelationBuffers returned %d", i);
14681477

14691478
nblocks = smgrtruncate(onerel->rd_rel->relsmgr, onerel, nblocks);
14701479
Assert(nblocks >= 0);

0 commit comments

Comments
 (0)