mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03: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:
@ -5,7 +5,7 @@
|
|||||||
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
|
* Copyright (c) 2002-2005, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.7.2.2 2008/03/31 01:32:48 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/dbsize.c,v 1.7.2.3 2010/01/23 21:29:23 tgl Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -44,6 +44,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;
|
||||||
@ -95,6 +97,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;
|
||||||
@ -170,6 +174,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;
|
||||||
@ -246,6 +252,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/%u",
|
snprintf(pathname, MAXPGPATH, "%s/%u",
|
||||||
dirpath, rfn->relNode);
|
dirpath, rfn->relNode);
|
||||||
|
Reference in New Issue
Block a user