Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33065ef

Browse files
committed
Ensure that contrib/pgstattuple functions respond to cancel interrupts
reasonably promptly, by adding CHECK_FOR_INTERRUPTS in the per-page loops.Tatsuhito Kasahara
1 parent4c10623 commit33065ef

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎contrib/pgstattuple/pgstattuple.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.38 2009/06/11 14:48:52 momjian Exp $
2+
* $PostgreSQL: pgsql/contrib/pgstattuple/pgstattuple.c,v 1.39 2010/04/02 16:16:51 tgl Exp $
33
*
44
* Copyright (c) 2001,2002Tatsuo Ishii
55
*
@@ -276,6 +276,8 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
276276
/* scan the relation */
277277
while ((tuple=heap_getnext(scan,ForwardScanDirection))!=NULL)
278278
{
279+
CHECK_FOR_INTERRUPTS();
280+
279281
/* must hold a buffer lock to call HeapTupleSatisfiesVisibility */
280282
LockBuffer(scan->rs_cbuf,BUFFER_LOCK_SHARE);
281283

@@ -302,6 +304,8 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
302304

303305
while (block <=tupblock)
304306
{
307+
CHECK_FOR_INTERRUPTS();
308+
305309
buffer=ReadBuffer(rel,block);
306310
LockBuffer(buffer,BUFFER_LOCK_SHARE);
307311
stat.free_space+=PageGetHeapFreeSpace((Page)BufferGetPage(buffer));
@@ -313,6 +317,8 @@ pgstat_heap(Relation rel, FunctionCallInfo fcinfo)
313317

314318
while (block<nblocks)
315319
{
320+
CHECK_FOR_INTERRUPTS();
321+
316322
buffer=ReadBuffer(rel,block);
317323
LockBuffer(buffer,BUFFER_LOCK_SHARE);
318324
stat.free_space+=PageGetHeapFreeSpace((Page)BufferGetPage(buffer));
@@ -468,7 +474,11 @@ pgstat_index(Relation rel, BlockNumber start, pgstat_page pagefn,
468474
}
469475

470476
for (;blkno<nblocks;blkno++)
477+
{
478+
CHECK_FOR_INTERRUPTS();
479+
471480
pagefn(&stat,rel,blkno);
481+
}
472482
}
473483

474484
relation_close(rel,AccessShareLock);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp