Commit 39381507 authored by Tom Lane's avatar Tom Lane

Fix longstanding error in VACUUM: sometimes would examine a buffer page

after writing/unpinning it.  An actual failure is unlikely, unless the
system is tremendously short of buffers ... but a bug is a bug.
parent 1d4ee0cc
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.198 2001/06/27 23:31:38 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.199 2001/06/29 16:34:30 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -631,7 +631,6 @@ scan_heap(VRelStats *vacrelstats, Relation onerel, ...@@ -631,7 +631,6 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
maxoff; maxoff;
bool pgchanged, bool pgchanged,
tupgone, tupgone,
dobufrel,
notup; notup;
char *relname; char *relname;
VacPage vacpage, VacPage vacpage,
...@@ -931,15 +930,6 @@ scan_heap(VRelStats *vacrelstats, Relation onerel, ...@@ -931,15 +930,6 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
} }
} }
if (pgchanged)
{
WriteBuffer(buf);
dobufrel = false;
changed_pages++;
}
else
dobufrel = true;
if (tempPage != (Page) NULL) if (tempPage != (Page) NULL)
{ /* Some tuples are gone */ { /* Some tuples are gone */
PageRepairFragmentation(tempPage, NULL); PageRepairFragmentation(tempPage, NULL);
...@@ -955,8 +945,15 @@ scan_heap(VRelStats *vacrelstats, Relation onerel, ...@@ -955,8 +945,15 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
free_size += vacpage->free; free_size += vacpage->free;
reap_page(vacuum_pages, vacpage); reap_page(vacuum_pages, vacpage);
} }
if (dobufrel)
if (pgchanged)
{
WriteBuffer(buf);
changed_pages++;
}
else
ReleaseBuffer(buf); ReleaseBuffer(buf);
if (notup) if (notup)
empty_end_pages++; empty_end_pages++;
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment