PostgreSQL10.0preview安全增強-任意wal副本數,金融級高可用與可靠性並存需求

德哥發表於2017-03-24

標籤

PostgreSQL , 流複製 , 同步流複製 , 任意副本


背景

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


相關文章