Beruflich Dokumente
Kultur Dokumente
3. Serialization in Distributed DB
3.1 3.2 Distributed Transactions
Global and local TA in heterogenous distributed DB Local and global histories Direct and indirect conflicts Ticket based CC
Global transactions: Access data at multiple servers, steps at one or more location Relevant in both homogeneous and heterogeneous federations Local transactions: Run exclusively on a single server relevant in heterogeneous federations For now: global TAs
HS-2010
HS / TA-DCC-2- 2
Homogeneous / heterogeneous TA
A distributed DB server infrastructure is homogenous if the nodes - Use the same type of system (say DB2) - Distribution is transparent to the transaction program - No local autonomy of the nodes
Heterogeneous DB federation
A distributed DB infrastructure is heterogeneous if - Nodes have autonomy - May be of different type - TA programs may start subtransactions on other nodes - TA have a global coordinator
Typical configuration: parallel DBS Multiple Data Managers in 3-tier architecture for performance / scalability reasons
HS-2010 HS / TA-DCC-2- 3
HS-2010
HS / TA-DCC-2- 4
Global history
TA = { T1 , ... , Tm } executed in a federation of n sites Steps of Ti executed at different sites with local histories H1,, Hn Example 2 sites, one holds x, the other y: t Server 1: Server 2: H is a global history for TA with respect to H1 , ... , Hn if the local projections of H equal the local history at each site i(H) = Hi for 1 <= i <= n r1(x) w1(y) w2(x) c1 c2 c1 r2(y) c2
Global correctness
Global conflict serializability A global history S is globally conflict serializable if there exists a serial history over the global (sub-) transactions that is conflict equivalent to S. Local serializability at all sites not sufficient!
Global serializability
r1(x) r2(y)
w2(x) c1 c2 w1(y) c1
c2
HS-2010
HS / TA-DCC-2- 7
HS-2010
HS / TA-DCC-2- 8
Crucial point for isolation guarantee in distributed transactions: Total ordering among the TA has to be established by some means like a lock manager. Not a big deal in homogeneous distributed DB without autonomy but in heterogeneous, autonomous systems.
how?
Proof: obvious...
HS-2010
HS / TA-DCC-2- 9
HS-2010
HS / TA-DCC-2- 10
3.2 Heterogeneity
Heterogeneous Federations Independent servers with local autonomy - If all servers happen to be independent database servers: multidatabase system (MDBS) - No global knowledge, global protocols are not an option! - MDBS: loosely coupled distributed databases Important: - local transactions can interfere with global ones - can solutions with scheduling guarantees be built from localized components?
HS-2010 HS / TA-DCC-2- 11
Heterogeneous federation
Global transactions Global TA manager
...
...
HS-2010
Local transactions
Example:
s1: s2:
S1 = {a}, S2= {b,c} Global TA: t1 = r(a), w(b), t2 = w(a) r(c) Local TA t3 = r(b) w(c)
t2 t3 t4
t1 t3 t4
t1 t2 t3 t4
Local histories: S1: r1(a) w2(a) S2: r3(b) w1(b) r2(c) w3(c) local histories serializable: t1, t2 global history is not: t1 t2 t3 ?? # and t2 t3 t1 t2 t3 t1 ?? #
HS / TA-DCC-2- 16
HS-2010
Global histories
Consequence: Serializability of global TA without locals not sufficient to guarantee global serializability in heterogeneous federations Reason: indirect conflict between t1 and t2 at S2 caused by local TA t3:
r3(b) w1(b) r2(c) w3(c)
Global histories
Even read-only transactions may be in conflict (!) s1= {a ,b} , S2 = {c,d } S1: r1(a) r3(a) r3(b) w3(a) w3(b) r2(b) S2: r2(c) r4(c) r4(d) w4(c) w4(d) r1(d) Global transactions t1 and t2 (both read-only!) are serialized differently at either site.
t1 t3 t2 t2 t4 t4
HS-2010 HS / TA-DCC-2- 18
Solution in principle: Global TA manager has to guarantee same serialization sequence of global TAs also in case of indirect conflicts
HS-2010 HS / TA-DCC-2- 17
t1