2017-09-15 125 views
1

当用户注册到应用程序(现在少于25个用户数据库)时,我们使用Azure数据库为PostgreSQL(Service)创建每个用户的DB。postgresql pg_database_size在随机时间抛出异常

为了报告目的,我们需要每个用户数据库大小的信息。 要检索数据库的大小,我们有一个Postgres函数触发以下查询

SELECT pg_database.datname , pg_database_size(pg_database.datname) FROM 
pg_database 

我们执行该功能每隔一小时掷蔚蓝的功能,但在随机时间的Postgres抛出异常

Exception: Npgsql.PostgresException (0x80004005): 58P01: could not read directory "base/16452": No such file or directory at... 

例外保持相同的最多具有不同目录或文件位置的时间

有时它也会抛出异常

Exception: Npgsql.NpgsqlException (0x80004005): Exception while reading from stream ---> System.IO.IOException: Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ---> System.Net.Sockets.SocketException 

回答