diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index dba8c39..1cc28b4 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -646,12 +646,6 @@ void smgrtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks) { /* - * Get rid of any buffers for the about-to-be-deleted blocks. bufmgr will - * just drop them without bothering to write the contents. - */ - DropRelFileNodeBuffers(reln->smgr_rnode, forknum, nblocks); - - /* * Send a shared-inval message to force other backends to close any smgr * references they may have for this rel. This is useful because they * might have open file pointers to segments that got removed, and/or @@ -667,6 +661,12 @@ smgrtruncate(SMgrRelation reln, ForkNumber forknum, BlockNumber nblocks) * Do the truncation. */ smgrsw[reln->smgr_which].smgr_truncate(reln, forknum, nblocks); + + /* + * Get rid of any buffers for the about-to-be-deleted blocks. bufmgr will + * just drop them without bothering to write the contents. + */ + DropRelFileNodeBuffers(reln->smgr_rnode, forknum, nblocks); } /*