Title: Middleware based Data Replication providing Snapshot Isolation
1Middleware based Data Replication providing
Snapshot Isolation
- Yi Lin
- Bettina Kemme
- Marta Patiño-Martínez
- Ricardo Jiménez-Peris
- June 15, 2005
2Data Replication What,Why,How?
Without Replication
With Replication
- Problem
- Scalability,
- Fault Tolerance
Challenge Keep copies consistent
3Data Replication challenge
- Replica Concurrency Control
- Keep copies consistent
- Isolate concurrent transactions
- General correctness criteria
- 1-copy-serializability
Replica control
- Our new criteria
- 1-copy-snapshot isolation
4Implementing Replica Control
- Kernel-based approach
- Middleware-based approach
- Advantages
- Modular
- Do not need access to DB code
- Reusability
- Disadvantages
- No access to concurrency control information in
the kernel
5Related Work
- Some provide table-based concurrency control
Middle-R, Conflict Aware, C-JDBC - Some are primary/secondary approaches. Ganymed
- Updates must always be performed on primary copy
- Nearly all only look at 1-copy-serializability
Conflict Aware, GlobData, Middle-R, C-JDBC,
State Machine
primary
secondary
6Concurrency Control serializability
- Serializability
- Highest transaction isolation level
- to what extend transactions interfere with each
other - The result is the same as executing them
serially. - Conflict read/write and write/write
T0
w(x)
T1
w(x)
r(x)
w(y)
T2
r(x)
w(x)
time
T0
w(x)
T1
w(x)
r(x)
w(y)
T2
r(x),w(x)
time
7Concurrency Control Snapshot Isolation
- Snapshot Isolation (SI)
- Conflict only write/write
- Read from a snapshot of the committed data as of
the time the transaction starts. - First committer wins of 2 concurrent conflicting
write transactions, one commits, the other aborts - Similarity with optimistic concurrency control
- Very popular (Oracle, PostgreSQL, SQL Server 2005)
T0
w(x)
commit
T1
w(x)
r(x)
w(y)
abort
T2
r(x)
w(x)
time
8Remainder of the Talk
- Define 1-copy-SI
- Protocols
- Centralized middleware
- Decentralized middleware
- Evaluation
- Conclusions
9Our new correctness criteria 1-copy-SI
- 1-copy-SI The replicated system behaves as one
database providing SI. - Each DB provides SI.
- All read operations read from snapshots
producible in one DB
...
...
1-copy-SI
SI
10A Centralized Replica Control Protocol
- Challenge
- How to detect concurrent conflicting txns?
?Validation
succeed
fail
x
11A Centralized Replica Control Protocol
- How to detect two transactions are conflicting?
- Writeset contains modified tuples and their
corresponding primary keys. - If two writesets share some primary keys, they
conflict. - Note Snapshot Isolation only cares about
write/write conflicts.
Key1
T1
T2
12A Centralized Replica Control Protocol
- How to detect two transactions are concurrent?
start0
end1
T0
end2
start1
T1
T2
start1
counter
- A counter for each database, increased upon
committing a transaction - Record start time and end time of transactions
- T0.end ? T1.start T1.end ? T0.start ? T0 and
T1 not concurrent.
13- 1-copy-SI
- more than just keeping data consistent
T1w1(x), val. succeed T2w2(y), val. succeed
r3(x,y),c3
r4(x,y),c4
14T1w1(x), val. succeed T2w2(y), val. succeed
w1(x),c1
w1(x),c1
r3(x,y),c3
r4(x,y),c4
w2(y),c2
w2(y),c2
y
x
x
y
15T1w1(x), val. succeed T2w2(y), val. succeed
r4(x,y),c4
x
y
w1(x),c1
w2(y),c2
x
y
x
y
r3(x,y),c3
r4(x,y),c4
w2(y),c2
w1(x),c1
x
y
r4(x,y),c4
y
x
x
y
16Decentralized SIR Protocol
- Summary
- Validation? same as centralized approach
- Total order multicast ?all middleware components
make the same decision
T1
T2
17Experiment
No Replication
Decentralized
Table-based locking
5 sites, 100 update transactions,
18Conclusions
- Definition of 1-Copy-SI
- Middleware based Replication Protocols providing
1-Copy-SI - Replication transparent to clients
- Connect via JDBC and submit operations as if
non-replicated system - Tuple based concurrency control
19References
- Conflict-Aware C. Amza, A. L. Cox, and W.
Zwaenepoel. Conict-Aware Scheduling for Dynamic
Content Applications. In USENIX Symp. on Internet
Tech. and Sys., 2003. - C-JDBC E. Cecchet, J. Marguerite, and W.
Zwaenepoel. C-JDBC Flexible database clustering
middlerware, USENIX 2004 - Ganymed C. Plattner and G. Alonso. Ganymed
Scalable replication for transactional web
applications. In Middleware, 2004. - GlobData L. Rodrigues, H. Miranda, R. Almeida,
J. Martins, and P. Vicente. Strong Replication in
the GlobData Middleware. In Workshop on
Dependable Middleware-Based Systems, 2002. - Middle-R R. Jiménez-Peris, M. Patiño-Martínez,
B. Kemme, and G. Alonso. Improving Scalability of
Fault Tolerant Database Clusters. In ICDCS'02. - Postgres-R S. Wu and B. Kemme. Postges-R(SI)
Combining replica control with concurrency
control based on snapshot isolation. In ICDE,
Tokoyo, Japan, 2005. - State Machine F. Pedone, R. Guerraoui, and A.
Schiper. The Database State Machine Approach.
Distributed and Parallel Databases, 1471-98,
2003.
20Writeset
- Containing modified tuples and their primary keys
- Implemented by triggers or log sniffing
- Currently not provided by DB standard interfaces
- PostgreSQL is currently implementing such
interface -