PostgreSQL 10.0 preview 安全增强 - 任意wal副本数,金融级高可用与可靠性并存需求

1 minute read

背景

PostgreSQL很多年前就开始支持同步流复制,支持配置多个standby,当sync node异常时,potention standby节点会自动变成sync node。从而提供0丢失的高可用。

但是此前如果要配置超过2个副本的高可用时,需要打一个patch。

10.0将这个patch合并到了内核中,支持配置任意副本,即,所有节点都可能随时成为sync node。

比如有3个standby,配置为2时,则3个中任意2个收到事务结束的wal后,才会释放主库会话等待队列,返回用户。

这个特性已经达到了金融级的要求,例如两地三中心,可以保证有2个副本。

当然如果你的要求更高,可以配置5个甚至更多standby,那么即使挂掉3个备库,也不影响使用。

详见

Hi all,  
  
In 9.6 development cycle, we had been discussed about configuration  
syntax for a long time while considering expanding.  
As a result, we had new dedicated language for multiple synchronous  
replication, but it supports only priority method.  
We know that quorum commit is very useful for many users and can  
expand dedicated language easily for quorum commit.  
So I'd like to propose quorum commit for multiple synchronous replication here.  
  
The followings are changes attached patches made.  
- Add new syntax 'Any N ( node1, node2, ... )' to  
synchornous_standby_names for quorum commit.  
- In quorum commit, the master can return commit to client after  
received ACK from *at least* any N servers of listed standbys.  
- sync_priority of all listed servers are same, 1.  
- Add regression test for quorum commit.  
  
I was thinking that the syntax for quorum method would use '[ ... ]'  
but it will be confused with '( ... )' priority method used.  
001 patch adds 'Any N ( ... )' style syntax but I know that we still  
might need to discuss about better syntax, discussion is very welcome.  
Attached draft patch, please give me feedback.  
  
Regards,  
  
--  
Masahiko Sawada  

这个patch的讨论,详见邮件组,本文末尾URL。

PostgreSQL社区的作风非常严谨,一个patch可能在邮件组中讨论几个月甚至几年,根据大家的意见反复的修正,patch合并到master已经非常成熟,所以PostgreSQL的稳定性也是远近闻名的。

参考

https://commitfest.postgresql.org/12/826/

https://www.postgresql.org/message-id/flat/CAD21AoAACi9NeC_ecm+Vahm+MMA6nYh=Kqs3KB3np+MBOS_gZg@mail.gmail.com#CAD21AoAACi9NeC_ecm+Vahm+MMA6nYh=Kqs3KB3np+MBOS_gZg@mail.gmail.com

Flag Counter

digoal’s 大量PostgreSQL文章入口