当用户注册到应用程序时,我们正在使用Azure数据库为PostgreSQL(服务)为每个用户创建数据库(目前少于25个用户数据库)。
出于报告目的,我们需要每个用户的DB大小的信息。 要检索数据库大小,我们有一个Postgres函数,它会触发以下查询
SELECT pg_database.datname , pg_database_size(pg_database.datname) FROM
pg_database
我们每小时执行此函数抛出azure函数但在随机时间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