mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-11 19:20:40 +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
cfac3efb2f
commit
84cce31372
@ -5,7 +5,7 @@
|
|||||||
* Copyright (c) 2002-2006, PostgreSQL Global Development Group
|
* Copyright (c) 2002-2006, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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;
|
struct stat fst;
|
||||||
|
|
||||||
|
CHECK_FOR_INTERRUPTS();
|
||||||
|
|
||||||
if (strcmp(direntry->d_name, ".") == 0 ||
|
if (strcmp(direntry->d_name, ".") == 0 ||
|
||||||
strcmp(direntry->d_name, "..") == 0)
|
strcmp(direntry->d_name, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -96,6 +98,8 @@ calculate_database_size(Oid dbOid)
|
|||||||
|
|
||||||
while ((direntry = ReadDir(dirdesc, dirpath)) != NULL)
|
while ((direntry = ReadDir(dirdesc, dirpath)) != NULL)
|
||||||
{
|
{
|
||||||
|
CHECK_FOR_INTERRUPTS();
|
||||||
|
|
||||||
if (strcmp(direntry->d_name, ".") == 0 ||
|
if (strcmp(direntry->d_name, ".") == 0 ||
|
||||||
strcmp(direntry->d_name, "..") == 0)
|
strcmp(direntry->d_name, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -171,6 +175,8 @@ calculate_tablespace_size(Oid tblspcOid)
|
|||||||
{
|
{
|
||||||
struct stat fst;
|
struct stat fst;
|
||||||
|
|
||||||
|
CHECK_FOR_INTERRUPTS();
|
||||||
|
|
||||||
if (strcmp(direntry->d_name, ".") == 0 ||
|
if (strcmp(direntry->d_name, ".") == 0 ||
|
||||||
strcmp(direntry->d_name, "..") == 0)
|
strcmp(direntry->d_name, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
@ -239,6 +245,8 @@ calculate_relation_size(RelFileNode *rfn)
|
|||||||
{
|
{
|
||||||
struct stat fst;
|
struct stat fst;
|
||||||
|
|
||||||
|
CHECK_FOR_INTERRUPTS();
|
||||||
|
|
||||||
if (segcount == 0)
|
if (segcount == 0)
|
||||||
snprintf(pathname, MAXPGPATH, "%s",
|
snprintf(pathname, MAXPGPATH, "%s",
|
||||||
relationpath);
|
relationpath);
|
||||||
|
Loading…
Reference in New Issue
Block a user