aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/vacuum.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-10-15 22:40:29 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-10-15 22:40:29 +0000
commit9ffc8ed58b55cb3925bb95cc184583fcb9772013 (patch)
tree9039f51525070c611a86f03a2e85a13b24005ac3 /src/backend/commands/vacuum.c
parentdb9e2fd0a9144707055ed382f184f5a9c11aafff (diff)
downloadpostgresql-9ffc8ed58b55cb3925bb95cc184583fcb9772013.tar.gz
postgresql-9ffc8ed58b55cb3925bb95cc184583fcb9772013.zip
Repair possible failure to update hint bits back to disk, per
http://archives.postgresql.org/pgsql-hackers/2004-10/msg00464.php. This fix is intended to be permanent: it moves the responsibility for calling SetBufferCommitInfoNeedsSave() into the tqual.c routines, eliminating the requirement for callers to test whether t_infomask changed. Also, tighten validity checking on buffer IDs in bufmgr.c --- several routines were paranoid about out-of-range shared buffer numbers but not about out-of-range local ones, which seems a tad pointless.
Diffstat (limited to 'src/backend/commands/vacuum.c')
-rw-r--r--src/backend/commands/vacuum.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 232ec9a89e6..3d0c6e0e996 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.294 2004/10/07 14:19:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.295 2004/10/15 22:39:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1190,6 +1190,12 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
buf = ReadBuffer(onerel, blkno);
page = BufferGetPage(buf);
+ /*
+ * We don't bother to do LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE)
+ * because we assume that holding exclusive lock on the relation
+ * will keep other backends from looking at the page.
+ */
+
vacpage->blkno = blkno;
vacpage->offsets_used = 0;
vacpage->offsets_free = 0;
@@ -1235,7 +1241,6 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
offnum <= maxoff;
offnum = OffsetNumberNext(offnum))
{
- uint16 sv_infomask;
ItemId itemid = PageGetItemId(page, offnum);
bool tupgone = false;
@@ -1255,9 +1260,7 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
tuple.t_len = ItemIdGetLength(itemid);
ItemPointerSet(&(tuple.t_self), blkno, offnum);
- sv_infomask = tuple.t_data->t_infomask;
-
- switch (HeapTupleSatisfiesVacuum(tuple.t_data, OldestXmin))
+ switch (HeapTupleSatisfiesVacuum(tuple.t_data, OldestXmin, buf))
{
case HEAPTUPLE_DEAD:
tupgone = true; /* we can delete the tuple */
@@ -1348,10 +1351,6 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
break;
}
- /* check for hint-bit update by HeapTupleSatisfiesVacuum */
- if (sv_infomask != tuple.t_data->t_infomask)
- pgchanged = true;
-
if (tupgone)
{
ItemId lpp;