From 708f67c7a9d9970ae276cf82fc955df507b9ca1e Mon Sep 17 00:00:00 2001 From: "Vadim B. Mikheev" Date: Mon, 22 Sep 1997 07:12:33 +0000 Subject: [PATCH] Blowaway relation buffers from buffer pool before truncation. --- src/backend/commands/vacuum.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index af88b26ea1..3af40713b3 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.47 1997/09/12 04:07:30 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.48 1997/09/22 07:12:33 vadim Exp $ * *------------------------------------------------------------------------- */ @@ -56,6 +56,8 @@ #include +extern int BlowawayRelationBuffers(Relation rdesc, BlockNumber block); + bool VacuumRunning = false; static Portal vc_portal; @@ -1394,6 +1396,9 @@ Elapsed %u/%u sec.", /* truncate relation */ if (blkno < nblocks) { + i = BlowawayRelationBuffers(onerel, blkno); + if (i < 0) + elog (FATAL, "VACUUM (vc_rpfheap): BlowawayRelationBuffers returned %d", i); blkno = smgrtruncate(onerel->rd_rel->relsmgr, onerel, blkno); Assert(blkno >= 0); vacrelstats->npages = blkno; /* set new number of blocks */ @@ -1465,6 +1470,10 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList Vvpl) * it) before truncation */ FlushBufferPool(!TransactionFlushEnabled()); + + i = BlowawayRelationBuffers(onerel, nblocks); + if (i < 0) + elog (FATAL, "VACUUM (vc_vacheap): BlowawayRelationBuffers returned %d", i); nblocks = smgrtruncate(onerel->rd_rel->relsmgr, onerel, nblocks); Assert(nblocks >= 0);