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 @@
*
*
* 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,
maxoff;
bool pgchanged,
tupgone,
dobufrel,
notup;
char *relname;
VacPage vacpage,
......@@ -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)
{ /* Some tuples are gone */
PageRepairFragmentation(tempPage, NULL);
......@@ -955,8 +945,15 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
free_size += vacpage->free;
reap_page(vacuum_pages, vacpage);
}
if (dobufrel)
if (pgchanged)
{
WriteBuffer(buf);
changed_pages++;
}
else
ReleaseBuffer(buf);
if (notup)
empty_end_pages++;
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