Sie sind auf Seite 1von 3

3.

1 Distributed transactions: Local / global

3. Serialization in Distributed DB
3.1 3.2 Distributed Transactions

3.3 3.4 3.5

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

based on Weikum / Vossen: Transactional Information Systems, chap. 18

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

Typical situation: Distributed applications on autonomous systems.


Example: Amazon sells a product and sends a transport order to DHL

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 history: s = r1(x) w1(y) w2(x) c1 r2(y) c2

Note: each site has to commit for each TA


HS-2010 HS / TA-DCC-2- 5 HS-2010 HS / TA-DCC-2- 6

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

Example: Server 1: Server 2:

r1(x) r2(y)

w2(x) c1 c2 w1(y) c1

c2

Local histories serializable, however global: r2(y) w1(y) r1(x) w2(x) c1 c2

HS-2010

HS / TA-DCC-2- 7

HS-2010

HS / TA-DCC-2- 8

Global conflict serializability


Given: global history with local histories H1 , ... , Hn involving a set TA of transactions Ti and each Hi is conflict serializable. Theorem: S is globally conflict serializable there exists a total order < on TA that is consistent with each local serialization order of the transactions.

Global conflict serializability

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

...

Local TA managers and data servers

...

HS-2010

Local transactions

HS / TA-DCC-2- 12 Weikum / Vossen: Transactional Inf. Systems

3.3 Local and global histories


Local history at site S All operations of local TAs at S and those operations of global TAs executed at S (subtransactions at S) S1 = {a,b}, S2 = {c,d,e} /* data t1 = r(a) w(b) local at S1 t2 = w(d) r(e) local at S2 t3 = w(a) r(d) global Simplification: t4 = w(b) r(c) w(e) global Local histories: s1: r1(a) w3(a) c3 w1(b) c1 w4(b) c4 s2: r4(c) w2(d) r3(d) c3 r2(e) c2 w4(e) c4
HS-2010 HS / TA-DCC-2- 13

Local and global History


Let Ti= {ti} be set of local and global transactions, s1,sn local histories (at servers S1,...,Sn) in a federated system. A global history h is a sequence of - exactly the operations of all the local and global transactions and - local projections of h are the local ones (si)

resources disjoint, no replication.

Example:

s1: s2:

r1(a) w3(a) c3 w1(b) c1 w4(b) c4 r4(c) w2(d) r3(d) c3 r2(e) c2 w4(e) c4

red: local TAs

r1(a) r4(c) w2(d) r3(d) w3(a) c3 r2(d) c2 c3 w1(b) c1 w4(b) w4(e) c4 c4


HS-2010 HS / TA-DCC-2- 14

Serializability of global history


Global history serializable?
r1(a) r4(c) w2(d) r3(d) w3(a) c3 r2(d) c2 c3 w1(b) c1 w4(b) w4(e) c4 c4 s1: s2: r1(a) w3(a) c3 w1(b) c1 w4(b) c4 r4(c) w2(d) r3(d) c3 r2(e) c2 w4(e) c4

Serializablity of global history


Counterexample with serializable local histories and conservative scheduling of t1,t2 without a serializable global one

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

s1: t1 < t3, t1 < t4

t1 t3 t4

s2 : t2 < t4, t2 < t3

Note: without local TA serializable

Global history is serializable: t1 < t2 < 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

by chance! Local serializability does NOT imply global serializability


HS-2010 HS / TA-DCC-2- 15

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

Das könnte Ihnen auch gefallen