暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 14 preview - postgres_fdw 自动重建链接 - when broken when starting new remote transaction.

digoal 2020-10-10
363

作者

digoal

日期

2020-10-10

标签

PostgreSQL , postgres_fdw


背景

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=32a9c0bdf493cf5fc029ab44a22384d547290eff

```
postgres_fdw: reestablish new connection if cached one is detected as broken.
author Fujii Masao fujii@postgresql.org
Tue, 6 Oct 2020 09:31:09 +0800 (10:31 +0900)
committer Fujii Masao fujii@postgresql.org
Tue, 6 Oct 2020 09:51:07 +0800 (10:51 +0900)
commit 32a9c0bdf493cf5fc029ab44a22384d547290eff
tree 2d3984e535f8226c48122eacbe369150557e682b tree | snapshot
parent dd0a64ed435d4a266ed16adb8204e7222af6c164 commit | diff

postgres_fdw: reestablish new connection if cached one is detected as broken.

In postgres_fdw, once remote connections are established, they are cached
and re-used for subsequent queries and transactions. There can be some
cases where those cached connections are unavaiable, for example,
by the restart of remote server. In these cases, previously an error was
reported and the query accessing to remote server failed if new remote
transaction failed to start because the cached connection was broken.

This commit improves postgres_fdw so that new connection is remade
if broken connection is detected when starting new remote transaction.
This is useful to avoid unnecessary failure of queries when connection is
broken but can be reestablished.

Author: Bharath Rupireddy, tweaked a bit by Fujii Masao
Reviewed-by: Ashutosh Bapat, Tatsuhito Kasahara, Fujii Masao
Discussion: https://postgr.es/m/CALj2ACUAi23vf1WiHNar_LksM9EDOWXcbHCo-fD4Mbr1d=78YQ@mail.gmail.com
```

当postgres_fdw的远程数据库链接丢失:
- 如果是新建事务, 自动新建链接.
- 如果是老事务, 依旧保持失败, 确保原子性.

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论