]> granicus.if.org Git - postgresql/commit
When truncating a relation in-place (eg during VACUUM), do not try to unlink
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 20 Nov 2006 01:08:10 +0000 (01:08 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 20 Nov 2006 01:08:10 +0000 (01:08 +0000)
commitb8222e50062937d38de38d54782c013cd136bfe4
tree4edcf70fc4fad1797ee1f4b28a4c1432a5c3cca7
parent006284b2efd061c048b4e0198523f68d4e2bb88d
When truncating a relation in-place (eg during VACUUM), do not try to unlink
any no-longer-needed segments; just truncate them to zero bytes and leave
the files in place for possible future re-use.  This avoids problems when
the segments are re-used due to relation growth shortly after truncation.
Before, the bgwriter, and possibly other backends, could still be holding
open file references to the old segment files, and would write dirty blocks
into those files where they'd disappear from the view of other processes.

Back-patch as far as 8.0.  I believe the 7.x branches are not vulnerable,
because they had no bgwriter, and "blind" writes by other backends would
always be done via freshly-opened file references.
src/backend/storage/smgr/md.c