Postgres Database
Postgres Database
Replication Options
Darren Johnson
darren@up.hrcoxmail.com
The PGReplication Project
Agenda
Characterizing Replication
Replication Scenarios
PostgreSQL Replication
Postgres-R Concepts
PGReplication Project
Transaction Processing
3
Critical Properties of a Transaction
ACID
4
Updating the Database
w(x)
• Read Only (Primary
read- read-
copy / master - slave) only only
5
Propagating Updates
6
More Characteristics
7
Scenario 1 (Hot Fail Over)
8
Scenario 2 (Long Distance)
• Servers on different
coasts, and data needs
to be consistent San New
between them Diego York
– Fast local access
– Catastrophic failure
Orlando
– Data partitioned by
region
9
Scenario 3 (Cluster)
• Several servers in a
cluster instead of a
big mainframe
– Load balancing
– Fault resilience
– Scalability
10
Scenario 4 (Software Solution)
11
PostgreSQL Replication Projects
12
Usogres
13
eRserver
14
eRServer Desctiption Cont…
15
PostgreSQL Replicator
17
Postgres-R
18
Postgres-R Cont…
19
Postgres-R Goals
• Multicast
• Delivery order (FIFO, casual, total,etc.)
• Reliable delivery: all nodes vs. all
available nodes
• Membership control
• ISIS, Totem, Transis, Horus, Ensemble,
Spread
21
Ordering Transactions
22
Architecture of Postgres-R
original Client Client
Client PostgreSQL Client
Server Server
Postmaster
Local BE Local BE
Group
Communication Client
System
Server
Remote Remote Remote
BE BE BE
23
Basic Protocol
SITE A
• All operations are first
w(y)
r(z) performed locally at a
single site.
Local Phase
w(z) • Writes are sent in one
message to all sites at
w(z) Group the end of transaction.
Send Phase Communication • Write messages are
totally ordered.
Serial Phase l(z) • Serialization order
obeys total order (same
serialization order at all
Serial Phase l(y) sites).
• When receiving remote
writes, they must be
Write Phase w(y) applied
24
Basic Protocol - Conflict
SITE A SITE B
r(z) r(z) • Concurrency
Control must be
w(z) slightly modified.
w(z)
w(z)
w(z) Group
Communication
l(z) l(z) detect conflict
abort yellow
l(z) w(z)
detect conflict
abort yellow
25
PGReplication Project
27
Improving PGReplication
• Understanding replication
characteristics can help determine the
correct solution to a problem.
• Many solutions for replication not one
will fit all needs, so we need to be able
to support all of them.
29