第1页
NTT DATA Intellilink Corporation
Overview of Postgres-XC
Koichi Suzuki
Postgres-XC Development Group
Postgres Conference China 2014 December 12th, 2014 Tokyo, Japan
第2页
What is Postgres-XC
● Symmetric PostgerSQL cluster
– No master/slave replication – No read-only clusters – Every node can issue both read/write – Every node provides single consistent database view – Transparent transaction management
● Not just a replication
– Each table can be replicated/distributed by sharding – Parallel transaction/query execution
● So both read/write scalability
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第3页
Master/Slave with Log Shipping
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第4页
Postgres-XC Symmetric Cluster
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第5页
Architecture and Configuration
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第6页
Outline of Components
● GTM (Global Transaction Manager)
– Distributed MVCC
● Provide global transaction ID (GXID) to all the transactions ● Provide global snapshot to all the transactions
– Sequence
● GTM_Proxy
– Group communications to GTM and reduce amount of GTM network workload
● Coordinator
– Handles incoming SQL statements
● Parse, plan, conduct execution in datanodes and the coordinator. ● Integrate local results from each datanode involved.
● Datanode
– Actual data storage
● Almost vanilla PostgreSQL
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
Share the binary
第7页
Scalability
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
DBT-1 (Rev)
第8页
Scaling-out architecture
● Postgres-XC is designed for throughput scale-out. ● Additional duration for coordinator – datanode
communication required. ● Can handle more connection/transaction in parallel. ● For data load, you separate the data to be fed from
different coordinators.
– Key for data load scale-out. – Data load from single coordinator may not scale.
● XC scales up when multiple coordinators/datanodes are involved.
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第9页
Combining sharding and replication
DBT-1 example
CUSTOMER
ORDERS
ORDER_LINE
ITEM
SHOPPING_CART
C_ID C_UNAME C_PASSWD C_FNAME C_LNAME C_ADDR_ID C_PHONE C_EMAIL C_SINCE C_LAST_VISIT C_LOGIN C_EXPIRATION C_DISCOUNT C_BALANCE C_YTD_PMT C_BIRTHDATE C_DATA
ADDRESS
ADDR_ID ADDR_STREET1 ADDR_STREET2 ADDR_CITY ADDR_STATE ADDR_ZIP ADDR_CO_ID ADDR_C_ID
O_ID O_C_ID O_DATE O_SUB_TOTAL O_TAX O_TOTAL O_SHIP_TYPE O_BILL_ADDR_ID O_SHIP_ADDR_ID O_STATUS
Distributed with Customer ID
OL_ID OL_O_ID OL_I_ID OL_QTY OL_DISCOUNT OL_COMMENTS OL_C_ID
CC_XACTS
CX_I_ID CX_TYPE CX_NUM CX_NAME CX_EXPIRY CX_AUTH_ID CX_XACT_AMT CX_XACT_DATE CX_CO_ID CX_C_ID
Replicated
COUNTRY
CO_ID CO_NAME CO_EXCHANGE CO_CURRENCY
AUTHOR
OL_ID OL_O_ID OL_I_ID OL_QTY OL_DISCOUNT OL_COMMENTS OL_C_ID
I_ID I_TITLE I_A_ID I_PUB_DATE I_PUBLISHER I_SUBJECT I_DESC I_RELATED1 I_RELATED2 I_RELATED3 I_RELATED4 I_RELATED5 I_THUMBNAIL I_IMAGE I_SRP I_COST I_AVAIL I_ISBN I_PAGE I_BACKING I_DIMENASIONS
STOCK
ST_I_ID ST_STOCK
SC_ID SC_C_ID SC_DATE SC_SUB_TOTAL SC_TAX SC_SHIPPING_COST SC_TOTAL SC_C_FNAME SC_C_LNAME SC_C>DISCOUNT
Distributed with Shopping Cart ID
SHOPPING_CART_LINE
SCL_SC_ID SCL_I_ID SCL_QTY SCL_COST SCL_SRP SCL_TITLE SCL_BACKING SCL_C_ID
Distributed with ItemID
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第10页
How XC Scales both Read/Write
● Transaction Tables → Sharding
– Only one write – Parallel writes in datanodes
● Master Tables → Replication
– Relatively static: Not significant many-writes overhead – Local join with transaction tables → Most join operation can
be done locally in datanodes
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第11页
Postgres-XC API
● Binary compatible with PostgreSQL
– Limited support for ODBC
– JDBC may have a couple of restrictions
● Compatible statements to PostgreSQL
– Slight difference
● CREATE TABLE, etc. ● Constraints can be enforced only locally in each datanodes.
– Extra
● Coordinator/datanode membership management, etc.
– CREATE/ALTER/DROP NODE, EXECUTE DIRECT...
● Extension in aggregates
– Combiner functions
● Maintain consistency in point-in-time-recovery
– CREATE BARRIER
● No load balancing so far
● You should notice
– OID is local to each node
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第12页
Join Example (1)
● Replicated Table and Partitioned Table
– Can determine which datanode to go from WHERE clause
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第13页
Join Example (2)
● Replicated Table and Partitioned Table
– Cannot determine which datanode to go
October 24th, 2012
NTT DATA Intellilink Corporation
HA in Postgres-XC
第14页
Thank You Very Much!
Copyright © 2011 NTT DATA Corporation
October 24th, 2012
NTT DATA Intellilink Corporation
koichi@dbms.gmail.com
HA in Postgres-XC