diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-23 21:29:17 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-01-23 21:29:17 +0000 |
commit | 84cce313720b75642a098ceacdb2dc23fc35fcc5 (patch) | |
tree | c2fab2c65a4875f39aebda19105e2f8dac051e13 | |
parent | cfac3efb2f75d19b35f428fa4d248b4114cd0437 (diff) | |
download | postgresql-84cce313720b75642a098ceacdb2dc23fc35fcc5.tar.gz postgresql-84cce313720b75642a098ceacdb2dc23fc35fcc5.zip |
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.
-rw-r--r-- | src/backend/utils/adt/dbsize.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 24467d866bb..343817116c5 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -5,7 +5,7 @@ * Copyright (c) 2002-2006, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.9.2.2 2008/03/31 01:32:17 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.9.2.3 2010/01/23 21:29:17 tgl Exp $ * */ @@ -45,6 +45,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; @@ -96,6 +98,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; @@ -171,6 +175,8 @@ calculate_tablespace_size(Oid tblspcOid) { struct stat fst; + CHECK_FOR_INTERRUPTS(); + if (strcmp(direntry->d_name, ".") == 0 || strcmp(direntry->d_name, "..") == 0) continue; @@ -239,6 +245,8 @@ calculate_relation_size(RelFileNode *rfn) { struct stat fst; + CHECK_FOR_INTERRUPTS(); + if (segcount == 0) snprintf(pathname, MAXPGPATH, "%s", relationpath); |