Blowaway relation buffers from buffer pool before truncation.
This commit is contained in:
parent
94e52d38df
commit
708f67c7a9
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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 <port-protos.h>
|
#include <port-protos.h>
|
||||||
|
|
||||||
|
extern int BlowawayRelationBuffers(Relation rdesc, BlockNumber block);
|
||||||
|
|
||||||
bool VacuumRunning = false;
|
bool VacuumRunning = false;
|
||||||
|
|
||||||
static Portal vc_portal;
|
static Portal vc_portal;
|
||||||
@ -1394,6 +1396,9 @@ Elapsed %u/%u sec.",
|
|||||||
/* truncate relation */
|
/* truncate relation */
|
||||||
if (blkno < nblocks)
|
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);
|
blkno = smgrtruncate(onerel->rd_rel->relsmgr, onerel, blkno);
|
||||||
Assert(blkno >= 0);
|
Assert(blkno >= 0);
|
||||||
vacrelstats->npages = blkno; /* set new number of blocks */
|
vacrelstats->npages = blkno; /* set new number of blocks */
|
||||||
@ -1466,6 +1471,10 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList Vvpl)
|
|||||||
*/
|
*/
|
||||||
FlushBufferPool(!TransactionFlushEnabled());
|
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);
|
nblocks = smgrtruncate(onerel->rd_rel->relsmgr, onerel, nblocks);
|
||||||
Assert(nblocks >= 0);
|
Assert(nblocks >= 0);
|
||||||
vacrelstats->npages = nblocks; /* set new number of blocks */
|
vacrelstats->npages = nblocks; /* set new number of blocks */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user