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:
Tom Lane 2010-01-23 21:29:00 +00:00
parent a06ea6f532
commit 841df96f83

View File

@ -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);