Commit 3b6cbce4 authored by Tom Lane's avatar Tom Lane

Add CHECK_FOR_INTERRUPTS() in various strategic spots, per comments

from Hiroshi.
parent 734e4212
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.86 2001/11/23 23:41:54 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.87 2002/01/06 00:37:43 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -596,6 +596,8 @@ btbulkdelete(PG_FUNCTION_ARGS) ...@@ -596,6 +596,8 @@ btbulkdelete(PG_FUNCTION_ARGS)
IndexTuple itup; IndexTuple itup;
ItemPointer htup; ItemPointer htup;
CHECK_FOR_INTERRUPTS();
/* current is the next index tuple */ /* current is the next index tuple */
blkno = ItemPointerGetBlockNumber(current); blkno = ItemPointerGetBlockNumber(current);
offnum = ItemPointerGetOffsetNumber(current); offnum = ItemPointerGetOffsetNumber(current);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.170 2001/11/20 02:46:13 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.171 2002/01/06 00:37:44 tgl Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -1679,6 +1679,8 @@ IndexBuildHeapScan(Relation heapRelation, ...@@ -1679,6 +1679,8 @@ IndexBuildHeapScan(Relation heapRelation,
{ {
bool tupleIsAlive; bool tupleIsAlive;
CHECK_FOR_INTERRUPTS();
if (snapshot == SnapshotAny) if (snapshot == SnapshotAny)
{ {
/* do our own time qual check */ /* do our own time qual check */
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.24 2001/10/25 20:37:30 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.25 2002/01/06 00:37:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -516,6 +516,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, ...@@ -516,6 +516,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
rows[numrows++] = heap_copytuple(tuple); rows[numrows++] = heap_copytuple(tuple);
if (numrows >= targrows) if (numrows >= targrows)
break; break;
CHECK_FOR_INTERRUPTS();
} }
heap_endscan(scan); heap_endscan(scan);
...@@ -584,6 +585,8 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows, ...@@ -584,6 +585,8 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
OffsetNumber targoffset, OffsetNumber targoffset,
maxoffset; maxoffset;
CHECK_FOR_INTERRUPTS();
t = select_next_random_record(t, targrows, &rstate); t = select_next_random_record(t, targrows, &rstate);
/* Try to read the t'th record in the table */ /* Try to read the t'th record in the table */
targpos = t / tuplesperpage; targpos = t / tuplesperpage;
...@@ -881,6 +884,8 @@ compute_minimal_stats(VacAttrStats *stats, ...@@ -881,6 +884,8 @@ compute_minimal_stats(VacAttrStats *stats,
int firstcount1, int firstcount1,
j; j;
CHECK_FOR_INTERRUPTS();
value = heap_getattr(tuple, stats->attnum, tupDesc, &isnull); value = heap_getattr(tuple, stats->attnum, tupDesc, &isnull);
/* Check for null/nonnull */ /* Check for null/nonnull */
...@@ -1158,6 +1163,8 @@ compute_scalar_stats(VacAttrStats *stats, ...@@ -1158,6 +1163,8 @@ compute_scalar_stats(VacAttrStats *stats,
Datum value; Datum value;
bool isnull; bool isnull;
CHECK_FOR_INTERRUPTS();
value = heap_getattr(tuple, stats->attnum, tupDesc, &isnull); value = heap_getattr(tuple, stats->attnum, tupDesc, &isnull);
/* Check for null/nonnull */ /* Check for null/nonnull */
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.70 2001/10/25 05:49:24 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.71 2002/01/06 00:37:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -263,6 +263,8 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex) ...@@ -263,6 +263,8 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
HeapTupleData LocalHeapTuple; HeapTupleData LocalHeapTuple;
Buffer LocalBuffer; Buffer LocalBuffer;
CHECK_FOR_INTERRUPTS();
LocalHeapTuple.t_self = ScanResult->heap_iptr; LocalHeapTuple.t_self = ScanResult->heap_iptr;
LocalHeapTuple.t_datamcxt = NULL; LocalHeapTuple.t_datamcxt = NULL;
LocalHeapTuple.t_data = NULL; LocalHeapTuple.t_data = NULL;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.212 2001/11/05 17:46:25 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.213 2002/01/06 00:37:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -992,6 +992,8 @@ scan_heap(VRelStats *vacrelstats, Relation onerel, ...@@ -992,6 +992,8 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
bool do_reap, bool do_reap,
do_frag; do_frag;
CHECK_FOR_INTERRUPTS();
buf = ReadBuffer(onerel, blkno); buf = ReadBuffer(onerel, blkno);
page = BufferGetPage(buf); page = BufferGetPage(buf);
...@@ -1415,6 +1417,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, ...@@ -1415,6 +1417,8 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
blkno > last_move_dest_block; blkno > last_move_dest_block;
blkno--) blkno--)
{ {
CHECK_FOR_INTERRUPTS();
/* /*
* Forget fraged_pages pages at or after this one; they're no * Forget fraged_pages pages at or after this one; they're no
* longer useful as move targets, since we only want to move down. * longer useful as move targets, since we only want to move down.
...@@ -2127,6 +2131,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, ...@@ -2127,6 +2131,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
i < vacuumed_pages; i < vacuumed_pages;
i++, curpage++) i++, curpage++)
{ {
CHECK_FOR_INTERRUPTS();
Assert((*curpage)->blkno < blkno); Assert((*curpage)->blkno < blkno);
if ((*curpage)->offsets_used == 0) if ((*curpage)->offsets_used == 0)
{ {
...@@ -2157,6 +2162,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, ...@@ -2157,6 +2162,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
i < num_fraged_pages; i < num_fraged_pages;
i++, curpage++) i++, curpage++)
{ {
CHECK_FOR_INTERRUPTS();
Assert((*curpage)->blkno < blkno); Assert((*curpage)->blkno < blkno);
if ((*curpage)->blkno > last_move_dest_block) if ((*curpage)->blkno > last_move_dest_block)
break; /* no need to scan any further */ break; /* no need to scan any further */
...@@ -2342,6 +2348,7 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages) ...@@ -2342,6 +2348,7 @@ vacuum_heap(VRelStats *vacrelstats, Relation onerel, VacPageList vacuum_pages)
for (i = 0, vacpage = vacuum_pages->pagedesc; i < nblocks; i++, vacpage++) for (i = 0, vacpage = vacuum_pages->pagedesc; i < nblocks; i++, vacpage++)
{ {
CHECK_FOR_INTERRUPTS();
if ((*vacpage)->offsets_free > 0) if ((*vacpage)->offsets_free > 0)
{ {
buf = ReadBuffer(onerel, (*vacpage)->blkno); buf = ReadBuffer(onerel, (*vacpage)->blkno);
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v 1.10 2001/10/28 06:25:43 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v 1.11 2002/01/06 00:37:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -230,6 +230,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats, ...@@ -230,6 +230,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
hastup; hastup;
int prev_dead_count; int prev_dead_count;
CHECK_FOR_INTERRUPTS();
/* /*
* If we are close to overrunning the available space for * If we are close to overrunning the available space for
* dead-tuple TIDs, pause and do a cycle of vacuuming before we * dead-tuple TIDs, pause and do a cycle of vacuuming before we
...@@ -464,6 +466,8 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats) ...@@ -464,6 +466,8 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
Buffer buf; Buffer buf;
Page page; Page page;
CHECK_FOR_INTERRUPTS();
tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]); tblk = ItemPointerGetBlockNumber(&vacrelstats->dead_tuples[tupindex]);
buf = ReadBuffer(onerel, tblk); buf = ReadBuffer(onerel, tblk);
LockBufferForCleanup(buf); LockBufferForCleanup(buf);
...@@ -770,6 +774,8 @@ count_nondeletable_pages(Relation onerel, LVRelStats *vacrelstats) ...@@ -770,6 +774,8 @@ count_nondeletable_pages(Relation onerel, LVRelStats *vacrelstats)
tupgone, tupgone,
hastup; hastup;
CHECK_FOR_INTERRUPTS();
blkno--; blkno--;
buf = ReadBuffer(onerel, blkno); buf = ReadBuffer(onerel, blkno);
......
...@@ -12,17 +12,17 @@ ...@@ -12,17 +12,17 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.18 2001/10/25 05:49:27 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.19 2002/01/06 00:37:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/file.h> #include <sys/file.h>
#include "postgres.h"
#include "executor/executor.h" #include "executor/executor.h"
#include "miscadmin.h"
#include "utils/memutils.h" #include "utils/memutils.h"
...@@ -92,6 +92,8 @@ ExecScan(Scan *node, ...@@ -92,6 +92,8 @@ ExecScan(Scan *node,
{ {
TupleTableSlot *slot; TupleTableSlot *slot;
CHECK_FOR_INTERRUPTS();
slot = (*accessMtd) (node); slot = (*accessMtd) (node);
/* /*
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.21 2001/11/11 22:00:25 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.22 2002/01/06 00:37:44 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1233,6 +1233,7 @@ mergeonerun(Tuplesortstate *state) ...@@ -1233,6 +1233,7 @@ mergeonerun(Tuplesortstate *state)
*/ */
while (state->memtupcount > 0) while (state->memtupcount > 0)
{ {
CHECK_FOR_INTERRUPTS();
/* write the tuple to destTape */ /* write the tuple to destTape */
priorAvail = state->availMem; priorAvail = state->availMem;
srcTape = state->memtupindex[0]; srcTape = state->memtupindex[0];
......
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