mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Ensure that contrib/pgstattuple functions respond to cancel interrupts
reasonably promptly, by adding CHECK_FOR_INTERRUPTS in the per-page loops. Tatsuhito Kasahara
This commit is contained in:
parent
03ecb57737
commit
c383ff4ca1
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.20.2.1 2009/03/31 22:56:05 tgl Exp $
|
||||
* $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.20.2.2 2010/04/02 16:17:18 tgl Exp $
|
||||
*
|
||||
* Copyright (c) 2001,2002 Tatsuo Ishii
|
||||
*
|
||||
@ -29,6 +29,7 @@
|
||||
#include "access/heapam.h"
|
||||
#include "access/transam.h"
|
||||
#include "catalog/namespace.h"
|
||||
#include "miscadmin.h"
|
||||
#include "utils/builtins.h"
|
||||
|
||||
|
||||
@ -145,6 +146,8 @@ pgstattuple_real(Relation rel, FunctionCallInfo fcinfo)
|
||||
/* scan the relation */
|
||||
while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
|
||||
{
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
/* must hold a buffer lock to call HeapTupleSatisfiesNow */
|
||||
LockBuffer(scan->rs_cbuf, BUFFER_LOCK_SHARE);
|
||||
|
||||
@ -171,6 +174,8 @@ pgstattuple_real(Relation rel, FunctionCallInfo fcinfo)
|
||||
|
||||
while (block <= tupblock)
|
||||
{
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
buffer = ReadBuffer(rel, block);
|
||||
LockBuffer(buffer, BUFFER_LOCK_SHARE);
|
||||
free_space += PageGetFreeSpace((Page) BufferGetPage(buffer));
|
||||
@ -183,6 +188,8 @@ pgstattuple_real(Relation rel, FunctionCallInfo fcinfo)
|
||||
|
||||
while (block < nblocks)
|
||||
{
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
buffer = ReadBuffer(rel, block);
|
||||
free_space += PageGetFreeSpace((Page) BufferGetPage(buffer));
|
||||
ReleaseBuffer(buffer);
|
||||
|
Loading…
x
Reference in New Issue
Block a user