Presentation is loading. Please wait.

Presentation is loading. Please wait.

Universität Karlsruhe (TH) © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Chapter 2 Model for transactions.

Similar presentations


Presentation on theme: "Universität Karlsruhe (TH) © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Chapter 2 Model for transactions."— Presentation transcript:

1 Universität Karlsruhe (TH) © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Chapter 2 Model for transactions

2 2 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Read/write model Transaction 1Transaction 2... Transaction n Scheduler Database Manager Database Backup/Recovery Manager restart Archive Manager restore Basic operations in the model? We are only concerned with database consistency  we are only interested in database reads and writes. We abstract from transaction semantics except for database reads and writes. Basic operations are guaranteed to be formal consistent, atomic and isolated.

3 3 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Read/write model Definition 2.1 (Read/Write Model Transaction): A transaction t is a partial order of steps (actions) of the form r(x) or w(x), where x  D (D database) and reads and writes applied to the same object are strictly ordered. We write t = (op, <) for transaction t with step set op and partial order <. “Syntax”: Examples: t 1 = r(s)  w(s)  r(v)  w(v) short: r(s) w(s) r(v) w(v) t 2 = r(s)  w(s) r(v)  w(v)

4 4 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Read/write model Definition 2.1 (Read/Write Model Transaction): A transaction t is a partial order of steps (actions) of the form r(x) or w(x), where x  D (D database) and reads and writes applied to the same object are strictly ordered. We write t = (op, <) for transaction t with step set op and partial order <. “Syntax”: “Semantics”: Interpretation of j th step, p j, of t: If p j =r(x), then interpretation is assignment v j := x to local variable v j If p j =w(x) then interpretation is assignment x := f j (v j1,..., v jk ). with unknown function f j and j 1,..., j k denoting t‘s prior read steps. Worst-case assumption!

5 5 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Read/write model “Semantics”: Interpretation of j th step, p j, of t: If p j =r(x), then interpretation is assignment v j := x to local variable v j If p j =w(x) then interpretation is assignment x := f j (v j1,..., v jk ). with unknown function f j and j 1,..., j k denoting p j ‘s prior read steps. Examples: t 1 = r(s)  w(s)  r(v)  w(v) short: r(s) w(s) r(v) w(v) t 2 = r(s)  w(s) r(v)  w(v)

6 6 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Page model Transaction 1Transaction 2... Transaction n Scheduler Database Manager Database Backup/Recovery Manager restart Archive Manager restore Basic data elements in the model? reads and writes on database pages. Organized in data pages.

7 7 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Procedural model Transaction 1Transaction 2... Transaction n Scheduler Database Manager Database Backup/Recovery Manager restart Archive Manager restore Transactions in the model? reads and writes on database pages. Procedural combination

8 8 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Procedural model Definition 2.1 (Read/Write Model Transaction): A transaction t is a partial order of steps (actions) of the form r(x) or w(x), where x  D (D database) and reads and writes applied to the same object are strictly ordered. We write t = (op, <) for transaction t with step set op and partial order <. “Syntax”: For some operations their mutual order of execution does not affect the end result.  Allows us to utilize parallel architectures. Examples:r(s)  w(s) r(v)  w(v)

9 9 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Concurrency model Transaction 1Transaction 2... Transaction n Scheduler Database Manager Database Backup/Recovery Manager restart Archive Manager restore Transaction sets in the model? reads and writes on database pages. Result of „mixing“ the of different transactions? Result: Schedule.  Not every syntactically correct schedule is semantically correct (i.e., preserves the ACID properties).  Formal description of correct schedules needed. Procedural combination

10 10 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Concurrency model Transaction 1Transaction 2... Transaction n Scheduler Database Manager Database Backup/Recovery Manager restart Archive Manager restore Algorithms for the runtime generation of semantically correct schedules? Result: Schedule.  Not every syntactically correct schedule is semantically correct (i.e., preserves the ACID properties).  Formal description of correct schedules needed.  Application programs send basic operations.  Algorithm sorts these dynamically into a correct schedule.

11 11 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Concurrency model Transaction 1Transaction 2... Transaction n Scheduler Database Manager Database Backup/Recovery Manager restart Archive Manager restore Notation : T={t 1,..., t n } is the set of transactions covered by a schedule. Result: Schedule.  Not every syntactically correct schedule is semantically correct (i.e., preserves the ACID properties).  Formal description of correct schedules needed.

12 12 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Procedural model completed A transaction brackets a number of operations read write by begin transaction and end transaction or abort Successful completion of the transaction. Results are made persistent (commit). Unsuccessful termination of the transaction. Results are discarded. short b c a r w short

13 13 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Reads and writes on the same element are ordered Each operation occurs at most once If a or c in t i, then as the last operation Transaction model completed Definition 2.2 (Read/Write Model Transaction): A transaction t i is a partial order (op i,< i ), with op i all operations in t i and 1. op i  {r i (x),w i (x) | x is data element }  {a i,c i } (op’ i = op i \ {a i,c i }) 2.  p  op i p = c i  p = a i  (  q  op’ i q < i p) 3. r i (x),w i (x)  op i  (r i (x) < i w i (x)  w i (x) < i r i (x)) 4. a i  op i  c i  op i and c i  op i  a i  op i Covers the multiprocessor case If a or c in t i, only one of them

14 14 © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Transaction model completed Definition 2.2 (Read/Write Model Transaction): A transaction t i is a partial order (op i,< i ), with op i all operations in t i and 1. op i  {r i (x),w i (x) | x is data element }  {a i,c i } (op’ i = op i \ {a i,c i }) 2.  p  op i p = c i  p = a i  (  q  op’ i q < i p) 3. r i (x),w i (x)  op’ i  (r i (x) < i w i (x)  w i (x) < i r i (x)) 4. a i  op i  c i  op i and c i  op i  a i  op i Often excluded due to standard implementation: No read of an element after it was updated.


Download ppt "Universität Karlsruhe (TH) © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 2 Chapter 2 Model for transactions."

Similar presentations


Ads by Google