Add some missing vacuum_delay_point calls in GIST vacuuming.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 14 Feb 2006 16:39:32 +0000 (16:39 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 14 Feb 2006 16:39:32 +0000 (16:39 +0000)
src/backend/access/gist/gistvacuum.c

index b96d84fd024ebc00a14ca265b84f80ec821f7320..80c694a1978e9b15ce99f2aab590d693bd068e0c 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.14 2006/02/11 23:31:33 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.15 2006/02/14 16:39:32 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -68,6 +68,8 @@ gistVacuumUpdate(GistVacuum *gv, BlockNumber blkno, bool needunion)
    int         ncompleted = 0,
                lencompleted = 16;
 
+   vacuum_delay_point();
+
    buffer = ReadBuffer(gv->index, blkno);
 
    /*
@@ -406,9 +408,12 @@ gistvacuumcleanup(PG_FUNCTION_ARGS)
    freePages = (BlockNumber *) palloc(sizeof(BlockNumber) * maxFreePages);
    for (blkno = GIST_ROOT_BLKNO + 1; blkno < npages; blkno++)
    {
-       Buffer      buffer = ReadBuffer(rel, blkno);
+       Buffer      buffer;
        Page        page;
 
+       vacuum_delay_point();
+
+       buffer = ReadBuffer(rel, blkno);
        LockBuffer(buffer, GIST_SHARE);
        page = (Page) BufferGetPage(buffer);
 
@@ -561,7 +566,7 @@ gistbulkdelete(PG_FUNCTION_ARGS)
            page = (Page) BufferGetPage(buffer);
            if (stack->blkno == GIST_ROOT_BLKNO && !GistPageIsLeaf(page))
            {
-               /* the only root can become non-leaf during relock */
+               /* only the root can become non-leaf during relock */
                LockBuffer(buffer, GIST_UNLOCK);
                ReleaseBuffer(buffer);
                /* one more check */
@@ -649,7 +654,6 @@ gistbulkdelete(PG_FUNCTION_ARGS)
        LockBuffer(buffer, GIST_UNLOCK);
        ReleaseBuffer(buffer);
 
-
        ptr = stack->next;
        pfree(stack);
        stack = ptr;