From: Tom Lane Date: Sat, 23 Jan 2010 21:29:00 +0000 (+0000) Subject: Insert CHECK_FOR_INTERRUPTS calls into loops in dbsize.c, to ensure that X-Git-Tag: REL9_0_ALPHA4~191 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=841df96f83c8001e388f3149b4a362c785a34ed5;p=postgresql 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. --- diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 47d1df88fa..d2d9197587 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -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);