Skip site navigation (1) Skip section navigation (2)

pgsql: When truncating a relation in-place (eg during VACUUM), do not

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: When truncating a relation in-place (eg during VACUUM), do not
Date: 2006-11-20 01:08:02
Message-ID: 20061120010802.697719FA344@postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
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.

Tags:
----
REL8_1_STABLE

Modified Files:
--------------
    pgsql/src/backend/storage/smgr:
        md.c (r1.118 -> r1.118.2.1)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/smgr/md.c.diff?r1=1.118&r2=1.118.2.1)

pgsql-committers by date

Next:From: Tom LaneDate: 2006-11-20 01:08:10
Subject: pgsql: When truncating a relation in-place (eg during VACUUM), do not
Previous:From: Tom LaneDate: 2006-11-20 01:07:56
Subject: pgsql: When truncating a relation in-place (eg during VACUUM), do not

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group