Presentation is loading. Please wait.

Presentation is loading. Please wait.

Distributed Database Management Systems

Similar presentations


Presentation on theme: "Distributed Database Management Systems"— Presentation transcript:

1 Distributed Database Management Systems
Lecture 27

2 In the previous lecture
Defined Transaction Formally ACID Properties of a Transaction

3 In this Lecture ACID Properties Types of Transaction Transaction in DDBS

4 Isolation and consistency are interrelated, one supports other
Degree 3 provides full isolation SQL-92 identified isolation levels based on following phenomena.

5 Dirty Read: A transaction reads the written value of another transaction before its commitment, like, --, W1(x), ----, R2(x), --- ,C1(or A1)-----, C2(or A2).

6 Non-repeatable or Fuzzy Read: Two reads of same data item by same Tr and a write by another Tr on the same data item --, R1(x), ----, W2(x), --- ,C2-----, R1(x)----

7 Phantom: T1 performs a read on a predicate, T2 inserts tuples that satisfy the predicate
--, R1(P), ----, W2(yinP), --- ,C2(orA2)-----, C1(orA1)---

8 Isolation levels Read Uncommitted: all three phenomena possible
Read Committed: fuzzy read, phantoms possible; DR not possible Repeatable Read: Only phantoms possible Anomaly Serializable: None of the phenomena possible

9 4- Durability: Once committed, changes to DB are permanent.

10 Types of Transactions

11 Timing Structure on-line (short-life) vs batch (long-life)
flat (or simple) transactions nested transactions.

12 Organization of read and write actions
two-step (all reads before any write) Restricted (Read an item before write) action model (Read/write on an item to be atomic.

13 Flat transaction Consists of a sequence of primitive operations embraced between a begin and end markers. Begin_transaction Reservation end.

14 Nested transaction The operations of a transaction may themselves be transactions. Begin_transaction Reservation Begin_transaction Airline end {Airline} end {Reservation}

15 Nested Transactions Have the same properties as their parents; may themselves have other nested transactions. Introduces concurrency control and recovery concepts within the transaction.

16 Closed nesting Open nesting
Sub transactions begin after their parents and finish before them Commitment of a sub transaction is conditional upon the commitment of the parent (commitment through the root) Open nesting Sub transactions can execute and commit independently. Compensation may be necessary.

17 Workflows

18 Flat transaction model suits relatively small and simple environments
Certain environments need combination of open and nested models.

19 A candidate definition “ a collection of tasks organized to accomplish some business activity”
Different types of workflows.

20 Workflows generally involve long transactions, like a reservation transaction that may include Airline, Hotel, Auto reservations and bill generation.

21 Workflows exhibit open nesting semantics
So permits access to the results of sub-activity before the commitment of the major activity.

22 Some components are declared as vital, main activity aborts if a vital component aborts, otherwise it may commit even if a non-vital component aborts, like….

23 Compensating Transactions
Contingency Transactions.

24 Architecture Revisited

25 Begin Transaction, Read
Write, Commit, Abort Results Distributed Execution Monitor With other SCs With other TMs Transaction Manager With other Data processors Coordinates transactions exec Scheduler Sched/De-Sched requests

26 That concludes our basic discussion on Transactions.

27 Distributed Concurrency Control
Chapter 11

28 CC concerns synchronizing concurrent transactions maintaining consistency of the database and maximizing degree of concurrency.

29 Schedule or History An order in which the operations of a set of transactions are executed.

30 A schedule (history) can be defined as a partial order over the operations of a set of transactions.

31 T1: T2: T3: Read(x) Write(x) Commit Write(y) Read(z) Read(y)
S={W 2 (x),R 1 (x), R 3 (x),W 1 (x),C 1 ,W2(y), R 3 (y),R 2 (z),C 2 ,R 3 (z),C 3 }

32 Complete Schedule

33 A complete schedule S over a set of transactions T={T1, …, Tn} is a partial order
 SCT(T, <T) where T = Ui i , for i = 1, 2, …, n <T  U <i , for i = 1, 2, …, n For any two conflicting operations Oij, Okl ∈ T, either Oij <T Okl or Okl <T Oij

34 1 = {R1(x), W1(x), C1} 2 = {W2(x), W2(y), R2(z), C2}
T1: Read(x) Write(x) Commit T2: Write(y) Read(z) T3: Read(y) 1 = {R1(x), W1(x), C1} 2 = {W2(x), W2(y), R2(z), C2} 3 = {R3(x), R3(y), R3(z), C3} = 1 U 2 U 3 ={R1(x), W1(x), C1, W2(x), W2(y), R2(z), C2, R3(x), R3(y), R3(z), C3}

35 some of the ordering relationships are included.
R1(x) W2(x) R3(x) W1(x) W2(y) R3(y) C1 R2(z) R3(z) C C3 A schedule is a prefix of a complete schedule such that only some of the operations and only some of the ordering relationships are included.

36 Serial Schedule If all the transactions included in it execute one after another. A serial schedules always leaves the database in a consistent state.

37 They may end up with a different final state of DB each one of them being consistent
If we have three transactions, T1, T2, T3 then one serial schedule may be: T1 <S T3 <s T2 or T T T2

38 Interleaved Schedule A schedule is in which operations from different transactions are mixed with each other in execution.

39 Like S1 ={W2(x), R1(x), R3 (x), W1(x),C1, W2(y), R3(y), R2(z),C2 ,R3 (z), C3} is an interleaved schedule.


Download ppt "Distributed Database Management Systems"

Similar presentations


Ads by Google