pg使用mongo_fdw外部表时,如果外部mongo重启,则pg无法自动重连mongo,pg也必须重启。
root@937118f50889:~# psql -U postgres -d acmcoder -h 127.0.0.1 -p 5432
Password for user postgres:
psql (9.3.4)
SSL connection (cipher: DHE-RSA-AES256-GCM-SHA384, bits: 256)
Type "help" for help.
acmcoder=# SELECT * FROM testmongo;
_id | id | v
--------------------------+----+---
5770ed26a65e4cd5c9bf5ffc | 1 | 1
5770f0c8b6fc52594ac90541 | 2 | 2
5770f6a690a120b540fb759e | 6 | 3
(3 rows)
acmcoder=# SELECT * FROM testmongo;
_id | id | v
-----+----+---
(0 rows)
acmcoder=# SELECT * FROM testmongo;
_id | id | v
-----+----+---
(0 rows)
2016-06-28 01:18:33 UTC LOG: database system was interrupted; last known up at 2016-06-27 12:53:32 UTC
2016-06-28 01:18:33 UTC LOG: database system was not properly shut down; automatic recovery in progress
2016-06-28 01:18:33 UTC LOG: record with zero length at 0/3514218
2016-06-28 01:18:33 UTC LOG: redo is not required
2016-06-28 01:18:33 UTC LOG: database system is ready to accept connections
2016-06-28 01:18:33 UTC LOG: autovacuum launcher started
2016-06-28 01:19:23 UTC LOG: could not receive data from client: Connection reset by peer
2016-06-28 01:19:23 UTC LOG: could not receive data from client: Connection reset by peer
2016-06-28 01:19:23 UTC LOG: could not receive data from client: Connection reset by peer
2016-06-28 01:19:29 UTC LOG: could not receive data from client: Connection reset by peer
WARNING: mongo_connect() is deprecated, please use mongo_client()
2016-06-28 01:20:21 UTC LOG: could not receive data from client: Connection reset by peer
2016-06-28 01:20:21 UTC LOG: could not receive data from client: Connection reset by peer
acmcoder=# SELECT * FROM testmongo;
WARNING: terminating connection because of crash of another server process
DETAIL: The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT: In a moment you should be able to reconnect to the database and repeat your command.
SSL SYSCALL error: EOF detected
The connection to the server was lost. Attempting reset: Succeeded.
acmcoder=# SELECT * FROM testmongo;
_id | id | v
--------------------------+----+---
5770ed26a65e4cd5c9bf5ffc | 1 | 1
5770f0c8b6fc52594ac90541 | 2 | 2
5770f6a690a120b540fb759e | 6 | 3
(3 rows)
acmcoder=#
应该是缓存了链接导致的,看看mongo_fdw的代码能不能改进一下,提供释放链接的函数。
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。