mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Insert CHECK_FOR_INTERRUPTS calls into loops in dbsize.c, to ensure that
the various disk-size-reporting functions will respond to query cancel reasonably promptly even in very large databases. Per report from Kevin Grittner.
This commit is contained in:
parent
a06ea6f532
commit
841df96f83
@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2002-2010, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.27 2010/01/19 05:50:18 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.28 2010/01/23 21:29:00 tgl Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -46,6 +46,8 @@ db_dir_size(const char *path)
|
||||
{
|
||||
struct stat fst;
|
||||
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
if (strcmp(direntry->d_name, ".") == 0 ||
|
||||
strcmp(direntry->d_name, "..") == 0)
|
||||
continue;
|
||||
@ -104,6 +106,8 @@ calculate_database_size(Oid dbOid)
|
||||
|
||||
while ((direntry = ReadDir(dirdesc, dirpath)) != NULL)
|
||||
{
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
if (strcmp(direntry->d_name, ".") == 0 ||
|
||||
strcmp(direntry->d_name, "..") == 0)
|
||||
continue;
|
||||
@ -194,6 +198,8 @@ calculate_tablespace_size(Oid tblspcOid)
|
||||
{
|
||||
struct stat fst;
|
||||
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
if (strcmp(direntry->d_name, ".") == 0 ||
|
||||
strcmp(direntry->d_name, "..") == 0)
|
||||
continue;
|
||||
@ -262,6 +268,8 @@ calculate_relation_size(RelFileNode *rfn, ForkNumber forknum)
|
||||
{
|
||||
struct stat fst;
|
||||
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
|
||||
if (segcount == 0)
|
||||
snprintf(pathname, MAXPGPATH, "%s",
|
||||
relationpath);
|
||||
|
Loading…
Reference in New Issue
Block a user