mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +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
b60e3ddc2e
commit
2154452ca4
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Header: /cvsroot/pgsql/contrib/pgstattuple/pgstattuple.c,v 1.12.4.2 2009/03/31 22:56:28 tgl Exp $
|
* $Header: /cvsroot/pgsql/contrib/pgstattuple/pgstattuple.c,v 1.12.4.3 2010/04/02 16:17:31 tgl Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 2001,2002 Tatsuo Ishii
|
* Copyright (c) 2001,2002 Tatsuo Ishii
|
||||||
*
|
*
|
||||||
@ -29,6 +29,7 @@
|
|||||||
#include "access/heapam.h"
|
#include "access/heapam.h"
|
||||||
#include "access/transam.h"
|
#include "access/transam.h"
|
||||||
#include "catalog/namespace.h"
|
#include "catalog/namespace.h"
|
||||||
|
#include "miscadmin.h"
|
||||||
#include "utils/builtins.h"
|
#include "utils/builtins.h"
|
||||||
|
|
||||||
|
|
||||||
@ -149,6 +150,8 @@ pgstattuple_real(Relation rel)
|
|||||||
{
|
{
|
||||||
uint16 sv_infomask;
|
uint16 sv_infomask;
|
||||||
|
|
||||||
|
CHECK_FOR_INTERRUPTS();
|
||||||
|
|
||||||
sv_infomask = tuple->t_data->t_infomask;
|
sv_infomask = tuple->t_data->t_infomask;
|
||||||
if (HeapTupleSatisfiesNow(tuple->t_data))
|
if (HeapTupleSatisfiesNow(tuple->t_data))
|
||||||
{
|
{
|
||||||
@ -173,6 +176,8 @@ pgstattuple_real(Relation rel)
|
|||||||
|
|
||||||
while (block <= tupblock)
|
while (block <= tupblock)
|
||||||
{
|
{
|
||||||
|
CHECK_FOR_INTERRUPTS();
|
||||||
|
|
||||||
buffer = ReadBuffer(rel, block);
|
buffer = ReadBuffer(rel, block);
|
||||||
free_space += PageGetFreeSpace((Page) BufferGetPage(buffer));
|
free_space += PageGetFreeSpace((Page) BufferGetPage(buffer));
|
||||||
ReleaseBuffer(buffer);
|
ReleaseBuffer(buffer);
|
||||||
@ -183,6 +188,8 @@ pgstattuple_real(Relation rel)
|
|||||||
|
|
||||||
while (block < nblocks)
|
while (block < nblocks)
|
||||||
{
|
{
|
||||||
|
CHECK_FOR_INTERRUPTS();
|
||||||
|
|
||||||
buffer = ReadBuffer(rel, block);
|
buffer = ReadBuffer(rel, block);
|
||||||
free_space += PageGetFreeSpace((Page) BufferGetPage(buffer));
|
free_space += PageGetFreeSpace((Page) BufferGetPage(buffer));
|
||||||
ReleaseBuffer(buffer);
|
ReleaseBuffer(buffer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user