2017-09-15 124 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 

回答