SlideShare a Scribd company logo
1 of 46
Download to read offline
2 December 2005
Introduction to Databases
Transaction Management
Prof. Beat Signer
Department of Computer Science
Vrije Universiteit Brussel
http://www.beatsigner.com
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 2May 12, 2017
Context of Today's Lecture
Access
Methods
System
Buffers
Authorisation
Control
Integrity
Checker
Command
Processor
Program
Object Code
DDL
Compiler
File
Manager
Buffer
Manager
Recovery
Manager
Scheduler
Query
Optimiser
Transaction
Manager
Query
Compiler
Queries
Catalogue
Manager
DML
Preprocessor
Database
Schema
Application
Programs
Database
Manager
Data
Manager
DBMS
Programmers Users DB Admins
Based on 'Components of a DBMS', Database Systems,
T. Connolly and C. Begg, Addison-Wesley 2010
Data, Indices and
System Catalogue
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 3May 12, 2017
Transaction
CREATE PROCEDURE transfer(accountA CHAR(10), accountB CHAR(10), amount DECIMAL(12,2))
BEGIN
DECLARE currentBalance DECIMAL(12,2);
SELECT balance INTO currentBalance
FROM account
WHERE account.accountNumber = accountA;
IF (currentBalance > amount) THEN
UPDATE account
SET account.balance = balance – amount
WHERE account.accountNumber = accountA;
UPDATE account
SET account.balance = account.balance + amount
WHERE account.accountNumber = accountB;
ENDIF
END
EXEC transfer(314-229, 889-752, 700)
Ariane Peeters wants to
transfer 700 Euro from her
bank account (314-229) to her
landlord's account (889-752)
R(account)
W(account)
W(account)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 4May 12, 2017
Transaction ...
 A transaction is a sequence of operations that form a
single unit of work
 A transaction is often initiated by an application program
 begin a transaction
- START TRANSACTION
 end a transaction
- COMMIT (if successful) or ROLLBACK (if errors)
 A transaction Ti transforms one consistent database
state into another consistent database state
 during the execution of Ti the DB may be temporarily inconsistent
 Either the whole transaction must succeed or the effect
of all operations has to be undone (rollback)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 5May 12, 2017
Transaction ...
 There are two main transaction issues
 concurrent execution of multiple transactions
 recovery after hardware failures and system crashes
 In many SQL implementations, each SQL statement is a
transaction on its own
 this default behaviour can be disabled
 SQL:1999 introduced BEGIN ATOMIC ... END blocks
 see earlier SQL and Advanced SQL lectures for more details
 To preserve the integrity of data, the DBMS has to
ensure that the so-called ACID properties are fulfilled for
any transaction
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 6May 12, 2017
ACID Properties
 Atomicity
 either all operations of a transaction are reflected in the database
or none of them (all or nothing)
 Consistency
 if the database was is a consistent state before the transaction
started, it will be in a consistent state after the transaction has
been executed
 Isolation
 if transactions are executed in parallel, the effects of an ongoing
transaction must not be visible to other transactions
 Durability
 after a transaction finished successfully, its changes are
persistent and will not be lost (e.g. on system failure)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 7May 12, 2017
Money Transfer Example Revisited
 Transaction to transfer money from account A to B
 Atomicity
 if the transaction fails after step 4 but before step 8, the updates
on A should not be reflected in the database (rollback)
 Consistency
 the sum of A and B should not be changed by the transaction
1. start transaction
2. read(A)
3. A = A-700
4. write(A)
5. read(B)
6. B = B+700
7. write(B)
8. commit
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 8May 12, 2017
Money Transfer Example Revisited ...
 Isolation
 if another transaction is going to access the partially updated
database between step 4 and 7, it will see an inconsistent
database (with a sum of A and B which is less than it should be)
 Durability
 once the money has been transferred from A to B (commit), the
effect of the transaction must persist
- the only way to "undo" a committed transaction is to execute a compensating
transaction
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 9May 12, 2017
Transaction States
 Active
 initial state; transaction is in
this state while executing
 Partially committed
 after the last statement has
been executed
 Committed
 after successful completion
 Failed
 after discovery that a normal execution is no longer possible
- logical error (e.g. bad input), system error (e.g. deadlock) or system crash
 Aborted
 after the rollback of a transaction
committed
aborted
active
partially
committed
failed
START TRANS
ABORT
COMMIT
ROLLBACK
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 10May 12, 2017
Transaction Management
 Transaction Manager
 ensures that we proceed from one consistent state to another
consistent state (database consistency)
 ensures that transactions will not violate integrity constraints
 Scheduler
 provides a specific strategy for the execution of transactions and
the corresponding concurrency control
 avoids or resolves conflicts during concurrent data access
 Recovery Manager
 restore the database to the state it was in before a failure
occurred (e.g. due to software bug or hardware problem) while
executing one or multiple transactions
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 11May 12, 2017
Scheduler
 Serial execution of transactions
 each operation within a transaction can be executed atomically
 any serial execution of a set of transactions T1,..., Tn by different
users is regarded as a correct result
 Parallel execution of transactions
 improves the throughput and resource utilisation as well as the
average response time
 too much parallelism can lead to wrong results
- e.g. dirty reads, lost updates, phantoms, ...
 the scheduler has to choose the appropriate concurrency control
scheme to avoid problems during parallel execution
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 12May 12, 2017
Schedule
 A schedule S specifies the chronological order in which
the operations of concurrent transactions are executed
 a schedule for the transaction T1,..., Tn must contain all operations
of these transactions
 the schedule must preserve the order of the operations in each
individual transaction
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 13May 12, 2017
Example Schedules
 Let transaction T1 transfer 700 Euro from account A to B
and T2 transfer 10% of the balance from A to B
 critical are the read (R) and write (W) operations
 Schedule 1
 serial schedule where T1 is followed by T2
 Schedule 2
 non-serial schedule but equivalent to Schedule 1
R(A) t=A*0.1 R(B)W(A)A=A-t W(B)B=B+t
R(A) A=A-700 W(A) R(B) B=B+700 W(B)T1
T2
R(A) t=A*0.1 R(B)W(A)A=A-t W(B)B=B+t
R(A) A=A-700 W(A) R(B) B=B+700 W(B)T1
T2
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 14May 12, 2017
Example Schedules ...
 Schedule 3
 this schedule does not preserve the sum of A and B and therefore
leads to problems
T1
T2 R(A) t=A*0.1 R(B)W(A)A=A-t W(B)B=B+t
R(A) A=A-700 W(A) R(B) B=B+700 W(B)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 15May 12, 2017
Conflict Serialisability
 Two operations of transactions Ti and Tj form a conflict
pair if at least one of them is a write operation
 If a schedule S can be transformed into a schedule S' by
a series of swaps of non-conflicting operations, then
S and S' are conflict equivalent
 a conflict pair forces an order on the transactions
 A schedule S is conflict serialisable
if it is conflict equivalent to a
serial schedule Rj(x)
Wj(x)




Ri(x) Wi(x)
conflict pairs
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 16May 12, 2017
Conflict Serialisability Example
 Transactions
 T1: R1(x) W1(x) R1(z)
 T2: R2(y) R2(x) W2(y)
 T3: R3(y) R3(z) W3(z)
 Schedule S
 Conflict pairs
 <W1(x),R2(x)>, <R3(y),W2(y)> and <W3(z),R1(z)>
 Conflict equivalent schedule
R1(x) W1(x) R2(x)R2(y) W2(y)R3(z) W3(z) R1(z)R3(y)
R1(x) W1(x) R2(x) R3(y) W2(y)R3(z) R1(z)W3(z)R2(y)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 17May 12, 2017
Conflict Serialisability Example ...
 Transactions
 T1: R1(x) W1(x)
 T2: W2(x)
 Schedule S
 Conflict pairs
 <R1(x),W2(x)> and <W2(x),W1(x)>
 This schedule is not conflict serialisable!
R1(x) W2(x) W1(x)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 18May 12, 2017
Testing for Serialisability
 Check if there is a serial schedule with the same
ordering of the conflict pairs as the given schedule S
 Construct a precedence graph G=(V,E) for S
 the vertices V are represented by the transactions T1,..., Tn
 there is an edge from Ti to Tj if there exists a conflict pair <x,y> in
S with xTi and yTj and x is preceding y
 a schedule S is serialisable if its precedence graph is acyclic
 Algorithm to find and equivalent serial schedule S'
 construct the precedence graph for the schedule S
 perform a topological sorting of the graph
- randonly choose a vertex with no incoming edges and remove the vertex and
its outgoing edges from S (add its operations to S')
- repeat the vertex removal until there are no more vertices or a cycle occurs
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 19May 12, 2017
Conflict Serialisability Example
 Schedule S
 Conflict pairs
 <R1(y),W2(y)>, <R1(y),W4(y)>,
<R2(y),W4(y)>, <W2(y),R4(y)>,
<W2(y),W4(y)>, <R1(z),W3(z)>,
<R1(z),W4(z)>, <W3(z),R4(z)>,
<W3(z),W4(z)>
 Serialisable schedule T5T1T2T3T4
 note that there is more than one serialisable schedule for S
R2(x) R1(y) R1(z) R5(v) R5(w) R2(y) W2(y) W3(z)
R1(u) R4(y) W4(y) R4(z) W4(z) R1(u) W1(u)
T1 T2
T3 T4
T5
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 20May 12, 2017
Conflict Serialisability Example ...
 Schedule S
 Conflict pairs
 <R1(x),W2(x)> and <W2(x),W1(x)>
 There is no serialisable schedule for S since the
precedence graph has a cycle
R1(x) W2(x) W1(x) T1 T2
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 21May 12, 2017
Concurrency Control
 Different concurrency control schemes can be used to
ensure that the isolation property is ensured when
multiple transactions are executed in parallel
 The concurrency control schemes for implementing
serialisation in an online system include
 lock-based protocols
 validation-based protocols
- timestamp ordering
- optimistic concurreny control
 graph-based protocols
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 22May 12, 2017
Lock-based Protocols
 One way to ensure serialisability is to require that
data items can only be accessed in a mutually exclusive
manner
 The DBMS has to offer a mechanism to lock a specific
data object x for a given transaction Ti and mode m
 lock(Ti, x, m)
 unlock(Ti, x)
 A transaction has to request a lock in the appropriate
mode for a data object and can only proceed if the
scheduler grants the lock
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 23May 12, 2017
Lock-based Protocols ...
 At any given time, there can never be two trans-
actions with incompatible locks on the same data object
 the second transaction has to wait until the object in unlocked
 DBMS puts the waiting transactions into specific queues
 Current DBMSs implement two types (modes) of locks
 exclusive-mode lock (X)
- read and write access to the data object
 shared-mode lock (S)
- read-only access
- at any time several shared-mode
locks can be held simultaneously
 lock is only granted if there is no other transaction that is already
waiting for a lock on the same data object (to prevent starvation)
S
X




S X
lock compatibility matrix
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 24May 12, 2017
Locking Example
 Transactions
 T1: W1(x) W1(y)
 T2: W2(z) W2(y)
 Lock
 exclusive lock Xi(x) and unlock Ui(x)
 Schedule S
T1
T2
X1(x)
...
W1(x)
X2(z) W2(z)
X1(y) W1(y)
X2(y)
U1(x) U1(y)
W2(y) U2(z) U2(y)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 25May 12, 2017
Locking
 Note that locking on its own does not guarantee the
serialisability of a set of transactions T1,..., Tn
 Schedule S
 Precedence graph
 We need more than just locking  two-phase locking
T1
T2
X1(x) W1(x)
X2(x) W2(x) X2(y)
U1(x)
U2(y)W2(y) U2(x)
U1(y)X1(y) W1(y)
T1 T2
The graph has a cycle and therefore
the schedule is not serialisable!
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 26May 12, 2017
Two-Phase Locking (2PL)
 The two-phase locking protocol is based on two rules
 Rule 1
 a data object has to be locked (exclusive or shared lock) before it
can be accessed by a transaction (growing phase)
 Rule 2
 as soon as a transaction unlocks its first data object, it cannot
acquire any further locks (shrinking phase)
#locks
time
lock point
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 27May 12, 2017
Two-Phase Locking (2PL)
 The 2PL protocol guarantees serialisable schedules
 Problems of the 2PL protocol
 if we want to use the 2PL protocol, we have to know for each
transaction Ti when no further locks will be necessary (lock point)
- not very realistic to have this kind of a priori knowledge
 the 2PL protocol is not deadlock free
 potential problems in the case of an abort/rollback of an
operation (cascading rollbacks)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 28May 12, 2017
2PL Cascading Rollback Problem
 The 2PL protocol is not suited to handle transactions that
are aborted since cascading rollbacks may occur
 Cascading rollback
 transaction Ti ends with an abort/rollback operation A
 this might trigger a previously committed transaction Tj to be
aborted too!
 Abort example
#locks
time
lock points
T1 T2
C2 A1
An abort A1 of transaction T1 can result
in an abort of transaction T2 since it got
access to "shared" data objects after T1
reached its lock point
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 29May 12, 2017
2PL Deadlock Problem
 Two transactions Ti and Tj might wait in a cycle for a lock
held by the other transaction
 Example
 The scheduler has to periodically check whether such
cycles (deadlocks) exist
 use a directed wait-for graph to model the dependencies between
transactions
 if a deadlock occurs (cycle in the wait-for graph), the scheduler
has to reset one of the participating transactions
T1
T2
X1(x) R1(x)
X2(y) R2(y) S2(x)
S1(y)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 30May 12, 2017
Strict Two-Phase Locking (S2PL)
 The strict two-phase locking protocol is based on two rules
 Rule 1
 a data object has to be locked (exclusive or shared lock) before it
can be accessed by a transaction (growing phase)
 Rule 2
 a transaction keeps all locks until the end of the transaction and
releases them all at once (commit/abort phase)
#locks
time
lock point
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 31May 12, 2017
Strict Two-Phase Locking (S2PL)
 The S2PL protocol guarantees serialisable schedules
 S2PL avoids cascading aborts but it is still not deadlock free
 S2PL is implemented in every major database system
 S2PL can be implemented in a deadlock-free manner
(deadlock prevention)
 transaction has to aquire all necessary locks (preclaiming
of locks) before the first operation is executed
 reduces potential concurrency for long transactions
#locks
time
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 32May 12, 2017
Locking Granularity
 Locking protocols such as 2PL or S2PL can be applied
at various granularity levels
 pages/blocks
- commonly used
 relations
- very coarse and restrictive
 tuples
 There is a trade-off between concurrency and overhead
 Small granularity
 higher level of potential concurrency but larger locking overhead
 Large granularity
 less potential for concurrency but smaller locking overhead
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 33May 12, 2017
Validation-based Protocols
 Rather than to prevent conflicts from the beginning, it is
sufficient to detect them and resolve them
 abort transaction in the case that a conflict is detected
 works efficiently if the probability for conflicts is very low
 Example scheduling techniques
 timestamp ordering
 optimistic concurrency control
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 34May 12, 2017
Timestamp Ordering
 Each transaction Ti gets a unique timestamp TS(Ti)
assigned
 e.g. based on system clock or a logical counter
 Timestamp ordering rule
 if operation oi,m(x) is in conflict with operation oj,n(x) and oi,m(x) is
part of transaction Ti whereas oj,n(x) is part of Tj, then they have to
be ordered oi,m(x) < oj,n(x) if TS(Ti) < TS(Tj)
 the timestamp order defines the serialisation order
 For each access of a data object the scheduler has to
check whether a later transaction (larger timestamp) has
already accessed the object
 W-TS(x): largest timestamp of transaction writing x
 R-TS(x): largest timestamp of transaction reading x
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 35May 12, 2017
Timestamp Ordering Scheduler
 Ti wants to read object x
 TS(Ti) < W-TS(x)
- Ti wants to read old data  reset Ti
 TS(Ti) W-TS(x)
- permit read operation and update R-TS(x)
 Ti wants to write object x
 TS(Ti) < R-TS(x)
- there is a newer transaction that already read x  reset Ti
 TS(Ti) < W-TS(x)
- Ti wants to write an obsolete value  reset Ti
 TS(Ti)  R-TS(x) and TS(Ti)  W-TS(x)
- permit write operation and update W-TS(x)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 36May 12, 2017
Optimistic Concurrency Control (OCC)
 Assumes that there will not be many conflicts
 Transactions are executed with the explicit risk of
abortion
 in snapshot isolation each transaction has a private workspace
 Three phases of a transaction Ti
 reading and execution phase
- Ti reads objects of the database (read set of Ti) and writes private versions
(write set of Ti)
 validation phase
- before writing the private versions to the database a conflict analysis is
performed
 writing phase
- if the validation was positive the private versions are written to the disk
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 37May 12, 2017
Recovery
 The recovery manager has to ensure that the
atomicity and durability properties are preserved in
the case of a system failure
 Different types of system failures
 transaction failure
- logical error
• internal transaction problems (e.g. bad data input or data not found)
- system error
• system in an undesirable state (e.g. deadlock)
 system crash
- software bug or hardware malfunction not affecting the non-volatile storage
 disk failure
- content loss on non-volatile storage (e.g. data transfer error or head crash)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 38May 12, 2017
Log-based Recovery
 After a system failure we should be able to return to a
state where ongoing transactions have either been
sucessfully completed or had no effect on the data at all
 To support undo and redo operations, we must write
logging information to a stable storage before modifying
the database
 atomicity
- undo based on logging information
 persistency
- redo based on logging information
 redo and undo operations must be idempotent
- executing them multiple times has the same effect as executing them once
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 39May 12, 2017
Log-based Recovery ...
 A log file consists of a sequence of log records which
can be of the following types
 start of transaction Ti
- <Ti start>
 transaction Ti updates the value V1 of data item Xj to value V2
- <Ti, Xj, V1, V2>
 commit of transaction Ti
- < Ti commit>
 abort of transaction Ti
- < Ti abort>
 We can either perform an immediate or a deferred
database modification
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 40May 12, 2017
Immediate Modification Technique
 Allows uncommited database modifications while the
transaction is still in its active state
 Before a transaction Ti starts, we write the corresponding
start record to the log
 Each write operation is preceded by the corresponding
update record in the log
 When the transaction Ti partially commits, we write the
corresponding commit record to the log
 To support concurrent transactions we further have to
ensure that there are no conflicting update operations
(e.g. by using S2PL)
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 41May 12, 2017
Logging Example
 The two transactions might result in the following log file
(annotated with the database state)
read(A)
A = A-700
write(A)
read(B)
B = B+700
write(B)
read(C)
C = C-500
write(C)
Transaction T1 Transaction T2
<T1 start>
<T1, A, 2000, 1300>
<T2 start>
<T2, C, 1300, 800>
<T2 commit>
<T1, B, 1800, 2500>
<T1 commit>
Log file
A = 1300
C = 800
B = 2500
Database state
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 42May 12, 2017
Restart Recovery
 After a crash the system scans the log file and constructs
two lists of transactions
 redo-list
- contains each transaction Ti for which a <Ti commit> log record exists
 undo-list
- contains each transaction Ti for which no <Ti commit> log record exists
 The system then performs the following two steps
(1) scan the log file in reverse order and for each log record of a
transaction Ti in the undo-list perform an undo operation
(2) scan the log file in forward order and for each log record of a
transaction Ti in the redo-list perform a redo operation
 To avoid a scan of the entire log file, special checkpoint
operations can be performed periodically
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 43May 12, 2017
Homework
 Study the following chapters of the
Database System Concepts book
 chapter 14
- sections 14.1-14.10
- Transactions
 chapter 15
- sections 15.1-15.11
- Concurrency Control
 chapter 16
- sections 16.1-16.10
- Recovery System
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 44May 12, 2017
Exercise 10
 Query Processing and Query Optimisation
Beat Signer - Department of Computer Science - bsigner@vub.ac.be 45May 12, 2017
References
 A. Silberschatz, H. Korth and S. Sudarshan,
Database System Concepts (Sixth Edition),
McGraw-Hill, 2010
2 December 2005
Next Lecture
NoSQL Databases

More Related Content

What's hot

OS - Ch2
OS - Ch2OS - Ch2
OS - Ch2sphs
 
Context model
Context modelContext model
Context modelUbaid423
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Meghaj Mallick
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMSkoolkampus
 
Data cube computation
Data cube computationData cube computation
Data cube computationRashmi Sheikh
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesMeghaj Mallick
 
Coupling , Cohesion and there Types
Coupling , Cohesion and there TypesCoupling , Cohesion and there Types
Coupling , Cohesion and there TypesMunaam Munawar
 
Agile and plan based development processes
Agile and plan based development processesAgile and plan based development processes
Agile and plan based development processessommerville-videos
 
A generic view of software engineering
A generic view of software engineeringA generic view of software engineering
A generic view of software engineeringInocentshuja Ahmad
 
Understanding isolation levels
Understanding isolation levelsUnderstanding isolation levels
Understanding isolation levelsHieu Nguyen Trung
 
5.2 mining time series data
5.2 mining time series data5.2 mining time series data
5.2 mining time series dataKrish_ver2
 
Domain-Specific Software Engineering
Domain-Specific Software EngineeringDomain-Specific Software Engineering
Domain-Specific Software Engineeringelliando dias
 
Chapter 5 slides
Chapter 5 slidesChapter 5 slides
Chapter 5 slideslara_ays
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database DesignArchit Saxena
 
Multivector and multiprocessor
Multivector and multiprocessorMultivector and multiprocessor
Multivector and multiprocessorKishan Panara
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architecturesPooja Dixit
 

What's hot (20)

OS - Ch2
OS - Ch2OS - Ch2
OS - Ch2
 
D B M S Animate
D B M S AnimateD B M S Animate
D B M S Animate
 
Parallel Database
Parallel DatabaseParallel Database
Parallel Database
 
Context model
Context modelContext model
Context model
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Temporal databases
Temporal databasesTemporal databases
Temporal databases
 
Data cube computation
Data cube computationData cube computation
Data cube computation
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed Databases
 
Coupling , Cohesion and there Types
Coupling , Cohesion and there TypesCoupling , Cohesion and there Types
Coupling , Cohesion and there Types
 
Agile and plan based development processes
Agile and plan based development processesAgile and plan based development processes
Agile and plan based development processes
 
A generic view of software engineering
A generic view of software engineeringA generic view of software engineering
A generic view of software engineering
 
Understanding isolation levels
Understanding isolation levelsUnderstanding isolation levels
Understanding isolation levels
 
5.2 mining time series data
5.2 mining time series data5.2 mining time series data
5.2 mining time series data
 
6.distributed shared memory
6.distributed shared memory6.distributed shared memory
6.distributed shared memory
 
Domain-Specific Software Engineering
Domain-Specific Software EngineeringDomain-Specific Software Engineering
Domain-Specific Software Engineering
 
Chapter 5 slides
Chapter 5 slidesChapter 5 slides
Chapter 5 slides
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Multivector and multiprocessor
Multivector and multiprocessorMultivector and multiprocessor
Multivector and multiprocessor
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architectures
 

Viewers also liked

Transaction management
Transaction managementTransaction management
Transaction managementrenuka_a
 
Transaction Management
Transaction Management Transaction Management
Transaction Management Visakh V
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and propertiesChetan Mahawar
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbmsNancy Gulati
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMSMegha Patel
 
Chapter 5 Database Transaction Management
Chapter 5 Database Transaction ManagementChapter 5 Database Transaction Management
Chapter 5 Database Transaction ManagementEddyzulham Mahluzydde
 

Viewers also liked (7)

Transaction management
Transaction managementTransaction management
Transaction management
 
Transaction Management
Transaction Management Transaction Management
Transaction Management
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and properties
 
Transaction states PPT
Transaction states PPTTransaction states PPT
Transaction states PPT
 
Transactions in dbms
Transactions in dbmsTransactions in dbms
Transactions in dbms
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 
Chapter 5 Database Transaction Management
Chapter 5 Database Transaction ManagementChapter 5 Database Transaction Management
Chapter 5 Database Transaction Management
 

Similar to Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)

transaction management, concept & State
transaction management, concept & Statetransaction management, concept & State
transaction management, concept & StateSurya Swaroop
 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxRoshni814224
 
The Challenges of Distributing Postgres: A Citus Story | DataEngConf NYC 2017...
The Challenges of Distributing Postgres: A Citus Story | DataEngConf NYC 2017...The Challenges of Distributing Postgres: A Citus Story | DataEngConf NYC 2017...
The Challenges of Distributing Postgres: A Citus Story | DataEngConf NYC 2017...Citus Data
 
The Challenges of Distributing Postgres: A Citus Story
The Challenges of Distributing Postgres: A Citus StoryThe Challenges of Distributing Postgres: A Citus Story
The Challenges of Distributing Postgres: A Citus StoryHanna Kelman
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryAjit Nayak
 
Scaling Cloud-Scale Translytics Workloads with Omid and Phoenix
Scaling Cloud-Scale Translytics Workloads with Omid and PhoenixScaling Cloud-Scale Translytics Workloads with Omid and Phoenix
Scaling Cloud-Scale Translytics Workloads with Omid and PhoenixDataWorks Summit
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisUniversity of Illinois,Chicago
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisUniversity of Illinois,Chicago
 
Transaction slide
Transaction slideTransaction slide
Transaction slideshawon roy
 
Lesson12 recovery architectures
Lesson12 recovery architecturesLesson12 recovery architectures
Lesson12 recovery architecturesRaval Vijay
 
Oracle GoldenGate 12c CDR Presentation for ECO
Oracle GoldenGate 12c CDR Presentation for ECOOracle GoldenGate 12c CDR Presentation for ECO
Oracle GoldenGate 12c CDR Presentation for ECOBobby Curtis
 
CS 542 -- Query Execution
CS 542 -- Query ExecutionCS 542 -- Query Execution
CS 542 -- Query ExecutionJ Singh
 
MSBI and Data WareHouse techniques by Quontra
MSBI and Data WareHouse techniques by Quontra MSBI and Data WareHouse techniques by Quontra
MSBI and Data WareHouse techniques by Quontra QUONTRASOLUTIONS
 

Similar to Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR) (20)

transaction management, concept & State
transaction management, concept & Statetransaction management, concept & State
transaction management, concept & State
 
Unit06 dbms
Unit06 dbmsUnit06 dbms
Unit06 dbms
 
Dbms
DbmsDbms
Dbms
 
Ch15
Ch15Ch15
Ch15
 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptx
 
The Challenges of Distributing Postgres: A Citus Story | DataEngConf NYC 2017...
The Challenges of Distributing Postgres: A Citus Story | DataEngConf NYC 2017...The Challenges of Distributing Postgres: A Citus Story | DataEngConf NYC 2017...
The Challenges of Distributing Postgres: A Citus Story | DataEngConf NYC 2017...
 
The Challenges of Distributing Postgres: A Citus Story
The Challenges of Distributing Postgres: A Citus StoryThe Challenges of Distributing Postgres: A Citus Story
The Challenges of Distributing Postgres: A Citus Story
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and Recovery
 
24904 lecture11
24904 lecture1124904 lecture11
24904 lecture11
 
Scaling Cloud-Scale Translytics Workloads with Omid and Phoenix
Scaling Cloud-Scale Translytics Workloads with Omid and PhoenixScaling Cloud-Scale Translytics Workloads with Omid and Phoenix
Scaling Cloud-Scale Translytics Workloads with Omid and Phoenix
 
A
AA
A
 
Join dependency
Join dependencyJoin dependency
Join dependency
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
Transaction slide
Transaction slideTransaction slide
Transaction slide
 
Lesson12 recovery architectures
Lesson12 recovery architecturesLesson12 recovery architectures
Lesson12 recovery architectures
 
Oracle GoldenGate 12c CDR Presentation for ECO
Oracle GoldenGate 12c CDR Presentation for ECOOracle GoldenGate 12c CDR Presentation for ECO
Oracle GoldenGate 12c CDR Presentation for ECO
 
CS 542 -- Query Execution
CS 542 -- Query ExecutionCS 542 -- Query Execution
CS 542 -- Query Execution
 
MSBI and Data WareHouse techniques by Quontra
MSBI and Data WareHouse techniques by Quontra MSBI and Data WareHouse techniques by Quontra
MSBI and Data WareHouse techniques by Quontra
 
Chapter17
Chapter17Chapter17
Chapter17
 

More from Beat Signer

Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)
Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)
Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)Beat Signer
 
Indoor Positioning Using the OpenHPS Framework
Indoor Positioning Using the OpenHPS FrameworkIndoor Positioning Using the OpenHPS Framework
Indoor Positioning Using the OpenHPS FrameworkBeat Signer
 
Personalised Learning Environments Based on Knowledge Graphs and the Zone of ...
Personalised Learning Environments Based on Knowledge Graphs and the Zone of ...Personalised Learning Environments Based on Knowledge Graphs and the Zone of ...
Personalised Learning Environments Based on Knowledge Graphs and the Zone of ...Beat Signer
 
Cross-Media Technologies and Applications - Future Directions for Personal In...
Cross-Media Technologies and Applications - Future Directions for Personal In...Cross-Media Technologies and Applications - Future Directions for Personal In...
Cross-Media Technologies and Applications - Future Directions for Personal In...Beat Signer
 
Bridging the Gap: Managing and Interacting with Information Across Media Boun...
Bridging the Gap: Managing and Interacting with Information Across Media Boun...Bridging the Gap: Managing and Interacting with Information Across Media Boun...
Bridging the Gap: Managing and Interacting with Information Across Media Boun...Beat Signer
 
Codeschool in a Box: A Low-Barrier Approach to Packaging Programming Curricula
Codeschool in a Box: A Low-Barrier Approach to Packaging Programming CurriculaCodeschool in a Box: A Low-Barrier Approach to Packaging Programming Curricula
Codeschool in a Box: A Low-Barrier Approach to Packaging Programming CurriculaBeat Signer
 
The RSL Hypermedia Metamodel and Its Application in Cross-Media Solutions
The RSL Hypermedia Metamodel and Its Application in Cross-Media Solutions The RSL Hypermedia Metamodel and Its Application in Cross-Media Solutions
The RSL Hypermedia Metamodel and Its Application in Cross-Media Solutions Beat Signer
 
Case Studies and Course Review - Lecture 12 - Information Visualisation (4019...
Case Studies and Course Review - Lecture 12 - Information Visualisation (4019...Case Studies and Course Review - Lecture 12 - Information Visualisation (4019...
Case Studies and Course Review - Lecture 12 - Information Visualisation (4019...Beat Signer
 
Dashboards - Lecture 11 - Information Visualisation (4019538FNR)
Dashboards - Lecture 11 - Information Visualisation (4019538FNR)Dashboards - Lecture 11 - Information Visualisation (4019538FNR)
Dashboards - Lecture 11 - Information Visualisation (4019538FNR)Beat Signer
 
Interaction - Lecture 10 - Information Visualisation (4019538FNR)
Interaction - Lecture 10 - Information Visualisation (4019538FNR)Interaction - Lecture 10 - Information Visualisation (4019538FNR)
Interaction - Lecture 10 - Information Visualisation (4019538FNR)Beat Signer
 
View Manipulation and Reduction - Lecture 9 - Information Visualisation (4019...
View Manipulation and Reduction - Lecture 9 - Information Visualisation (4019...View Manipulation and Reduction - Lecture 9 - Information Visualisation (4019...
View Manipulation and Reduction - Lecture 9 - Information Visualisation (4019...Beat Signer
 
Visualisation Techniques - Lecture 8 - Information Visualisation (4019538FNR)
Visualisation Techniques - Lecture 8 - Information Visualisation (4019538FNR)Visualisation Techniques - Lecture 8 - Information Visualisation (4019538FNR)
Visualisation Techniques - Lecture 8 - Information Visualisation (4019538FNR)Beat Signer
 
Design Guidelines and Principles - Lecture 7 - Information Visualisation (401...
Design Guidelines and Principles - Lecture 7 - Information Visualisation (401...Design Guidelines and Principles - Lecture 7 - Information Visualisation (401...
Design Guidelines and Principles - Lecture 7 - Information Visualisation (401...Beat Signer
 
Data Processing and Visualisation Frameworks - Lecture 6 - Information Visual...
Data Processing and Visualisation Frameworks - Lecture 6 - Information Visual...Data Processing and Visualisation Frameworks - Lecture 6 - Information Visual...
Data Processing and Visualisation Frameworks - Lecture 6 - Information Visual...Beat Signer
 
Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)
Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)
Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)Beat Signer
 
Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)
Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)
Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)Beat Signer
 
Data Representation - Lecture 3 - Information Visualisation (4019538FNR)
Data Representation - Lecture 3 - Information Visualisation (4019538FNR)Data Representation - Lecture 3 - Information Visualisation (4019538FNR)
Data Representation - Lecture 3 - Information Visualisation (4019538FNR)Beat Signer
 
Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4...
Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4...Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4...
Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4...Beat Signer
 
Introduction - Lecture 1 - Information Visualisation (4019538FNR)
Introduction - Lecture 1 - Information Visualisation (4019538FNR)Introduction - Lecture 1 - Information Visualisation (4019538FNR)
Introduction - Lecture 1 - Information Visualisation (4019538FNR)Beat Signer
 
Towards a Framework for Dynamic Data Physicalisation
Towards a Framework for Dynamic Data PhysicalisationTowards a Framework for Dynamic Data Physicalisation
Towards a Framework for Dynamic Data PhysicalisationBeat Signer
 

More from Beat Signer (20)

Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)
Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)
Introduction - Lecture 1 - Human-Computer Interaction (1023841ANR)
 
Indoor Positioning Using the OpenHPS Framework
Indoor Positioning Using the OpenHPS FrameworkIndoor Positioning Using the OpenHPS Framework
Indoor Positioning Using the OpenHPS Framework
 
Personalised Learning Environments Based on Knowledge Graphs and the Zone of ...
Personalised Learning Environments Based on Knowledge Graphs and the Zone of ...Personalised Learning Environments Based on Knowledge Graphs and the Zone of ...
Personalised Learning Environments Based on Knowledge Graphs and the Zone of ...
 
Cross-Media Technologies and Applications - Future Directions for Personal In...
Cross-Media Technologies and Applications - Future Directions for Personal In...Cross-Media Technologies and Applications - Future Directions for Personal In...
Cross-Media Technologies and Applications - Future Directions for Personal In...
 
Bridging the Gap: Managing and Interacting with Information Across Media Boun...
Bridging the Gap: Managing and Interacting with Information Across Media Boun...Bridging the Gap: Managing and Interacting with Information Across Media Boun...
Bridging the Gap: Managing and Interacting with Information Across Media Boun...
 
Codeschool in a Box: A Low-Barrier Approach to Packaging Programming Curricula
Codeschool in a Box: A Low-Barrier Approach to Packaging Programming CurriculaCodeschool in a Box: A Low-Barrier Approach to Packaging Programming Curricula
Codeschool in a Box: A Low-Barrier Approach to Packaging Programming Curricula
 
The RSL Hypermedia Metamodel and Its Application in Cross-Media Solutions
The RSL Hypermedia Metamodel and Its Application in Cross-Media Solutions The RSL Hypermedia Metamodel and Its Application in Cross-Media Solutions
The RSL Hypermedia Metamodel and Its Application in Cross-Media Solutions
 
Case Studies and Course Review - Lecture 12 - Information Visualisation (4019...
Case Studies and Course Review - Lecture 12 - Information Visualisation (4019...Case Studies and Course Review - Lecture 12 - Information Visualisation (4019...
Case Studies and Course Review - Lecture 12 - Information Visualisation (4019...
 
Dashboards - Lecture 11 - Information Visualisation (4019538FNR)
Dashboards - Lecture 11 - Information Visualisation (4019538FNR)Dashboards - Lecture 11 - Information Visualisation (4019538FNR)
Dashboards - Lecture 11 - Information Visualisation (4019538FNR)
 
Interaction - Lecture 10 - Information Visualisation (4019538FNR)
Interaction - Lecture 10 - Information Visualisation (4019538FNR)Interaction - Lecture 10 - Information Visualisation (4019538FNR)
Interaction - Lecture 10 - Information Visualisation (4019538FNR)
 
View Manipulation and Reduction - Lecture 9 - Information Visualisation (4019...
View Manipulation and Reduction - Lecture 9 - Information Visualisation (4019...View Manipulation and Reduction - Lecture 9 - Information Visualisation (4019...
View Manipulation and Reduction - Lecture 9 - Information Visualisation (4019...
 
Visualisation Techniques - Lecture 8 - Information Visualisation (4019538FNR)
Visualisation Techniques - Lecture 8 - Information Visualisation (4019538FNR)Visualisation Techniques - Lecture 8 - Information Visualisation (4019538FNR)
Visualisation Techniques - Lecture 8 - Information Visualisation (4019538FNR)
 
Design Guidelines and Principles - Lecture 7 - Information Visualisation (401...
Design Guidelines and Principles - Lecture 7 - Information Visualisation (401...Design Guidelines and Principles - Lecture 7 - Information Visualisation (401...
Design Guidelines and Principles - Lecture 7 - Information Visualisation (401...
 
Data Processing and Visualisation Frameworks - Lecture 6 - Information Visual...
Data Processing and Visualisation Frameworks - Lecture 6 - Information Visual...Data Processing and Visualisation Frameworks - Lecture 6 - Information Visual...
Data Processing and Visualisation Frameworks - Lecture 6 - Information Visual...
 
Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)
Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)
Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)
 
Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)
Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)
Analysis and Validation - Lecture 4 - Information Visualisation (4019538FNR)
 
Data Representation - Lecture 3 - Information Visualisation (4019538FNR)
Data Representation - Lecture 3 - Information Visualisation (4019538FNR)Data Representation - Lecture 3 - Information Visualisation (4019538FNR)
Data Representation - Lecture 3 - Information Visualisation (4019538FNR)
 
Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4...
Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4...Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4...
Human Perception and Colour Theory - Lecture 2 - Information Visualisation (4...
 
Introduction - Lecture 1 - Information Visualisation (4019538FNR)
Introduction - Lecture 1 - Information Visualisation (4019538FNR)Introduction - Lecture 1 - Information Visualisation (4019538FNR)
Introduction - Lecture 1 - Information Visualisation (4019538FNR)
 
Towards a Framework for Dynamic Data Physicalisation
Towards a Framework for Dynamic Data PhysicalisationTowards a Framework for Dynamic Data Physicalisation
Towards a Framework for Dynamic Data Physicalisation
 

Recently uploaded

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 

Recently uploaded (20)

Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 

Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)

  • 1. 2 December 2005 Introduction to Databases Transaction Management Prof. Beat Signer Department of Computer Science Vrije Universiteit Brussel http://www.beatsigner.com
  • 2. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 2May 12, 2017 Context of Today's Lecture Access Methods System Buffers Authorisation Control Integrity Checker Command Processor Program Object Code DDL Compiler File Manager Buffer Manager Recovery Manager Scheduler Query Optimiser Transaction Manager Query Compiler Queries Catalogue Manager DML Preprocessor Database Schema Application Programs Database Manager Data Manager DBMS Programmers Users DB Admins Based on 'Components of a DBMS', Database Systems, T. Connolly and C. Begg, Addison-Wesley 2010 Data, Indices and System Catalogue
  • 3. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 3May 12, 2017 Transaction CREATE PROCEDURE transfer(accountA CHAR(10), accountB CHAR(10), amount DECIMAL(12,2)) BEGIN DECLARE currentBalance DECIMAL(12,2); SELECT balance INTO currentBalance FROM account WHERE account.accountNumber = accountA; IF (currentBalance > amount) THEN UPDATE account SET account.balance = balance – amount WHERE account.accountNumber = accountA; UPDATE account SET account.balance = account.balance + amount WHERE account.accountNumber = accountB; ENDIF END EXEC transfer(314-229, 889-752, 700) Ariane Peeters wants to transfer 700 Euro from her bank account (314-229) to her landlord's account (889-752) R(account) W(account) W(account)
  • 4. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 4May 12, 2017 Transaction ...  A transaction is a sequence of operations that form a single unit of work  A transaction is often initiated by an application program  begin a transaction - START TRANSACTION  end a transaction - COMMIT (if successful) or ROLLBACK (if errors)  A transaction Ti transforms one consistent database state into another consistent database state  during the execution of Ti the DB may be temporarily inconsistent  Either the whole transaction must succeed or the effect of all operations has to be undone (rollback)
  • 5. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 5May 12, 2017 Transaction ...  There are two main transaction issues  concurrent execution of multiple transactions  recovery after hardware failures and system crashes  In many SQL implementations, each SQL statement is a transaction on its own  this default behaviour can be disabled  SQL:1999 introduced BEGIN ATOMIC ... END blocks  see earlier SQL and Advanced SQL lectures for more details  To preserve the integrity of data, the DBMS has to ensure that the so-called ACID properties are fulfilled for any transaction
  • 6. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 6May 12, 2017 ACID Properties  Atomicity  either all operations of a transaction are reflected in the database or none of them (all or nothing)  Consistency  if the database was is a consistent state before the transaction started, it will be in a consistent state after the transaction has been executed  Isolation  if transactions are executed in parallel, the effects of an ongoing transaction must not be visible to other transactions  Durability  after a transaction finished successfully, its changes are persistent and will not be lost (e.g. on system failure)
  • 7. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 7May 12, 2017 Money Transfer Example Revisited  Transaction to transfer money from account A to B  Atomicity  if the transaction fails after step 4 but before step 8, the updates on A should not be reflected in the database (rollback)  Consistency  the sum of A and B should not be changed by the transaction 1. start transaction 2. read(A) 3. A = A-700 4. write(A) 5. read(B) 6. B = B+700 7. write(B) 8. commit
  • 8. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 8May 12, 2017 Money Transfer Example Revisited ...  Isolation  if another transaction is going to access the partially updated database between step 4 and 7, it will see an inconsistent database (with a sum of A and B which is less than it should be)  Durability  once the money has been transferred from A to B (commit), the effect of the transaction must persist - the only way to "undo" a committed transaction is to execute a compensating transaction
  • 9. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 9May 12, 2017 Transaction States  Active  initial state; transaction is in this state while executing  Partially committed  after the last statement has been executed  Committed  after successful completion  Failed  after discovery that a normal execution is no longer possible - logical error (e.g. bad input), system error (e.g. deadlock) or system crash  Aborted  after the rollback of a transaction committed aborted active partially committed failed START TRANS ABORT COMMIT ROLLBACK
  • 10. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 10May 12, 2017 Transaction Management  Transaction Manager  ensures that we proceed from one consistent state to another consistent state (database consistency)  ensures that transactions will not violate integrity constraints  Scheduler  provides a specific strategy for the execution of transactions and the corresponding concurrency control  avoids or resolves conflicts during concurrent data access  Recovery Manager  restore the database to the state it was in before a failure occurred (e.g. due to software bug or hardware problem) while executing one or multiple transactions
  • 11. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 11May 12, 2017 Scheduler  Serial execution of transactions  each operation within a transaction can be executed atomically  any serial execution of a set of transactions T1,..., Tn by different users is regarded as a correct result  Parallel execution of transactions  improves the throughput and resource utilisation as well as the average response time  too much parallelism can lead to wrong results - e.g. dirty reads, lost updates, phantoms, ...  the scheduler has to choose the appropriate concurrency control scheme to avoid problems during parallel execution
  • 12. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 12May 12, 2017 Schedule  A schedule S specifies the chronological order in which the operations of concurrent transactions are executed  a schedule for the transaction T1,..., Tn must contain all operations of these transactions  the schedule must preserve the order of the operations in each individual transaction
  • 13. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 13May 12, 2017 Example Schedules  Let transaction T1 transfer 700 Euro from account A to B and T2 transfer 10% of the balance from A to B  critical are the read (R) and write (W) operations  Schedule 1  serial schedule where T1 is followed by T2  Schedule 2  non-serial schedule but equivalent to Schedule 1 R(A) t=A*0.1 R(B)W(A)A=A-t W(B)B=B+t R(A) A=A-700 W(A) R(B) B=B+700 W(B)T1 T2 R(A) t=A*0.1 R(B)W(A)A=A-t W(B)B=B+t R(A) A=A-700 W(A) R(B) B=B+700 W(B)T1 T2
  • 14. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 14May 12, 2017 Example Schedules ...  Schedule 3  this schedule does not preserve the sum of A and B and therefore leads to problems T1 T2 R(A) t=A*0.1 R(B)W(A)A=A-t W(B)B=B+t R(A) A=A-700 W(A) R(B) B=B+700 W(B)
  • 15. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 15May 12, 2017 Conflict Serialisability  Two operations of transactions Ti and Tj form a conflict pair if at least one of them is a write operation  If a schedule S can be transformed into a schedule S' by a series of swaps of non-conflicting operations, then S and S' are conflict equivalent  a conflict pair forces an order on the transactions  A schedule S is conflict serialisable if it is conflict equivalent to a serial schedule Rj(x) Wj(x)     Ri(x) Wi(x) conflict pairs
  • 16. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 16May 12, 2017 Conflict Serialisability Example  Transactions  T1: R1(x) W1(x) R1(z)  T2: R2(y) R2(x) W2(y)  T3: R3(y) R3(z) W3(z)  Schedule S  Conflict pairs  <W1(x),R2(x)>, <R3(y),W2(y)> and <W3(z),R1(z)>  Conflict equivalent schedule R1(x) W1(x) R2(x)R2(y) W2(y)R3(z) W3(z) R1(z)R3(y) R1(x) W1(x) R2(x) R3(y) W2(y)R3(z) R1(z)W3(z)R2(y)
  • 17. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 17May 12, 2017 Conflict Serialisability Example ...  Transactions  T1: R1(x) W1(x)  T2: W2(x)  Schedule S  Conflict pairs  <R1(x),W2(x)> and <W2(x),W1(x)>  This schedule is not conflict serialisable! R1(x) W2(x) W1(x)
  • 18. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 18May 12, 2017 Testing for Serialisability  Check if there is a serial schedule with the same ordering of the conflict pairs as the given schedule S  Construct a precedence graph G=(V,E) for S  the vertices V are represented by the transactions T1,..., Tn  there is an edge from Ti to Tj if there exists a conflict pair <x,y> in S with xTi and yTj and x is preceding y  a schedule S is serialisable if its precedence graph is acyclic  Algorithm to find and equivalent serial schedule S'  construct the precedence graph for the schedule S  perform a topological sorting of the graph - randonly choose a vertex with no incoming edges and remove the vertex and its outgoing edges from S (add its operations to S') - repeat the vertex removal until there are no more vertices or a cycle occurs
  • 19. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 19May 12, 2017 Conflict Serialisability Example  Schedule S  Conflict pairs  <R1(y),W2(y)>, <R1(y),W4(y)>, <R2(y),W4(y)>, <W2(y),R4(y)>, <W2(y),W4(y)>, <R1(z),W3(z)>, <R1(z),W4(z)>, <W3(z),R4(z)>, <W3(z),W4(z)>  Serialisable schedule T5T1T2T3T4  note that there is more than one serialisable schedule for S R2(x) R1(y) R1(z) R5(v) R5(w) R2(y) W2(y) W3(z) R1(u) R4(y) W4(y) R4(z) W4(z) R1(u) W1(u) T1 T2 T3 T4 T5
  • 20. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 20May 12, 2017 Conflict Serialisability Example ...  Schedule S  Conflict pairs  <R1(x),W2(x)> and <W2(x),W1(x)>  There is no serialisable schedule for S since the precedence graph has a cycle R1(x) W2(x) W1(x) T1 T2
  • 21. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 21May 12, 2017 Concurrency Control  Different concurrency control schemes can be used to ensure that the isolation property is ensured when multiple transactions are executed in parallel  The concurrency control schemes for implementing serialisation in an online system include  lock-based protocols  validation-based protocols - timestamp ordering - optimistic concurreny control  graph-based protocols
  • 22. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 22May 12, 2017 Lock-based Protocols  One way to ensure serialisability is to require that data items can only be accessed in a mutually exclusive manner  The DBMS has to offer a mechanism to lock a specific data object x for a given transaction Ti and mode m  lock(Ti, x, m)  unlock(Ti, x)  A transaction has to request a lock in the appropriate mode for a data object and can only proceed if the scheduler grants the lock
  • 23. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 23May 12, 2017 Lock-based Protocols ...  At any given time, there can never be two trans- actions with incompatible locks on the same data object  the second transaction has to wait until the object in unlocked  DBMS puts the waiting transactions into specific queues  Current DBMSs implement two types (modes) of locks  exclusive-mode lock (X) - read and write access to the data object  shared-mode lock (S) - read-only access - at any time several shared-mode locks can be held simultaneously  lock is only granted if there is no other transaction that is already waiting for a lock on the same data object (to prevent starvation) S X     S X lock compatibility matrix
  • 24. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 24May 12, 2017 Locking Example  Transactions  T1: W1(x) W1(y)  T2: W2(z) W2(y)  Lock  exclusive lock Xi(x) and unlock Ui(x)  Schedule S T1 T2 X1(x) ... W1(x) X2(z) W2(z) X1(y) W1(y) X2(y) U1(x) U1(y) W2(y) U2(z) U2(y)
  • 25. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 25May 12, 2017 Locking  Note that locking on its own does not guarantee the serialisability of a set of transactions T1,..., Tn  Schedule S  Precedence graph  We need more than just locking  two-phase locking T1 T2 X1(x) W1(x) X2(x) W2(x) X2(y) U1(x) U2(y)W2(y) U2(x) U1(y)X1(y) W1(y) T1 T2 The graph has a cycle and therefore the schedule is not serialisable!
  • 26. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 26May 12, 2017 Two-Phase Locking (2PL)  The two-phase locking protocol is based on two rules  Rule 1  a data object has to be locked (exclusive or shared lock) before it can be accessed by a transaction (growing phase)  Rule 2  as soon as a transaction unlocks its first data object, it cannot acquire any further locks (shrinking phase) #locks time lock point
  • 27. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 27May 12, 2017 Two-Phase Locking (2PL)  The 2PL protocol guarantees serialisable schedules  Problems of the 2PL protocol  if we want to use the 2PL protocol, we have to know for each transaction Ti when no further locks will be necessary (lock point) - not very realistic to have this kind of a priori knowledge  the 2PL protocol is not deadlock free  potential problems in the case of an abort/rollback of an operation (cascading rollbacks)
  • 28. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 28May 12, 2017 2PL Cascading Rollback Problem  The 2PL protocol is not suited to handle transactions that are aborted since cascading rollbacks may occur  Cascading rollback  transaction Ti ends with an abort/rollback operation A  this might trigger a previously committed transaction Tj to be aborted too!  Abort example #locks time lock points T1 T2 C2 A1 An abort A1 of transaction T1 can result in an abort of transaction T2 since it got access to "shared" data objects after T1 reached its lock point
  • 29. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 29May 12, 2017 2PL Deadlock Problem  Two transactions Ti and Tj might wait in a cycle for a lock held by the other transaction  Example  The scheduler has to periodically check whether such cycles (deadlocks) exist  use a directed wait-for graph to model the dependencies between transactions  if a deadlock occurs (cycle in the wait-for graph), the scheduler has to reset one of the participating transactions T1 T2 X1(x) R1(x) X2(y) R2(y) S2(x) S1(y)
  • 30. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 30May 12, 2017 Strict Two-Phase Locking (S2PL)  The strict two-phase locking protocol is based on two rules  Rule 1  a data object has to be locked (exclusive or shared lock) before it can be accessed by a transaction (growing phase)  Rule 2  a transaction keeps all locks until the end of the transaction and releases them all at once (commit/abort phase) #locks time lock point
  • 31. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 31May 12, 2017 Strict Two-Phase Locking (S2PL)  The S2PL protocol guarantees serialisable schedules  S2PL avoids cascading aborts but it is still not deadlock free  S2PL is implemented in every major database system  S2PL can be implemented in a deadlock-free manner (deadlock prevention)  transaction has to aquire all necessary locks (preclaiming of locks) before the first operation is executed  reduces potential concurrency for long transactions #locks time
  • 32. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 32May 12, 2017 Locking Granularity  Locking protocols such as 2PL or S2PL can be applied at various granularity levels  pages/blocks - commonly used  relations - very coarse and restrictive  tuples  There is a trade-off between concurrency and overhead  Small granularity  higher level of potential concurrency but larger locking overhead  Large granularity  less potential for concurrency but smaller locking overhead
  • 33. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 33May 12, 2017 Validation-based Protocols  Rather than to prevent conflicts from the beginning, it is sufficient to detect them and resolve them  abort transaction in the case that a conflict is detected  works efficiently if the probability for conflicts is very low  Example scheduling techniques  timestamp ordering  optimistic concurrency control
  • 34. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 34May 12, 2017 Timestamp Ordering  Each transaction Ti gets a unique timestamp TS(Ti) assigned  e.g. based on system clock or a logical counter  Timestamp ordering rule  if operation oi,m(x) is in conflict with operation oj,n(x) and oi,m(x) is part of transaction Ti whereas oj,n(x) is part of Tj, then they have to be ordered oi,m(x) < oj,n(x) if TS(Ti) < TS(Tj)  the timestamp order defines the serialisation order  For each access of a data object the scheduler has to check whether a later transaction (larger timestamp) has already accessed the object  W-TS(x): largest timestamp of transaction writing x  R-TS(x): largest timestamp of transaction reading x
  • 35. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 35May 12, 2017 Timestamp Ordering Scheduler  Ti wants to read object x  TS(Ti) < W-TS(x) - Ti wants to read old data  reset Ti  TS(Ti) W-TS(x) - permit read operation and update R-TS(x)  Ti wants to write object x  TS(Ti) < R-TS(x) - there is a newer transaction that already read x  reset Ti  TS(Ti) < W-TS(x) - Ti wants to write an obsolete value  reset Ti  TS(Ti)  R-TS(x) and TS(Ti)  W-TS(x) - permit write operation and update W-TS(x)
  • 36. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 36May 12, 2017 Optimistic Concurrency Control (OCC)  Assumes that there will not be many conflicts  Transactions are executed with the explicit risk of abortion  in snapshot isolation each transaction has a private workspace  Three phases of a transaction Ti  reading and execution phase - Ti reads objects of the database (read set of Ti) and writes private versions (write set of Ti)  validation phase - before writing the private versions to the database a conflict analysis is performed  writing phase - if the validation was positive the private versions are written to the disk
  • 37. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 37May 12, 2017 Recovery  The recovery manager has to ensure that the atomicity and durability properties are preserved in the case of a system failure  Different types of system failures  transaction failure - logical error • internal transaction problems (e.g. bad data input or data not found) - system error • system in an undesirable state (e.g. deadlock)  system crash - software bug or hardware malfunction not affecting the non-volatile storage  disk failure - content loss on non-volatile storage (e.g. data transfer error or head crash)
  • 38. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 38May 12, 2017 Log-based Recovery  After a system failure we should be able to return to a state where ongoing transactions have either been sucessfully completed or had no effect on the data at all  To support undo and redo operations, we must write logging information to a stable storage before modifying the database  atomicity - undo based on logging information  persistency - redo based on logging information  redo and undo operations must be idempotent - executing them multiple times has the same effect as executing them once
  • 39. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 39May 12, 2017 Log-based Recovery ...  A log file consists of a sequence of log records which can be of the following types  start of transaction Ti - <Ti start>  transaction Ti updates the value V1 of data item Xj to value V2 - <Ti, Xj, V1, V2>  commit of transaction Ti - < Ti commit>  abort of transaction Ti - < Ti abort>  We can either perform an immediate or a deferred database modification
  • 40. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 40May 12, 2017 Immediate Modification Technique  Allows uncommited database modifications while the transaction is still in its active state  Before a transaction Ti starts, we write the corresponding start record to the log  Each write operation is preceded by the corresponding update record in the log  When the transaction Ti partially commits, we write the corresponding commit record to the log  To support concurrent transactions we further have to ensure that there are no conflicting update operations (e.g. by using S2PL)
  • 41. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 41May 12, 2017 Logging Example  The two transactions might result in the following log file (annotated with the database state) read(A) A = A-700 write(A) read(B) B = B+700 write(B) read(C) C = C-500 write(C) Transaction T1 Transaction T2 <T1 start> <T1, A, 2000, 1300> <T2 start> <T2, C, 1300, 800> <T2 commit> <T1, B, 1800, 2500> <T1 commit> Log file A = 1300 C = 800 B = 2500 Database state
  • 42. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 42May 12, 2017 Restart Recovery  After a crash the system scans the log file and constructs two lists of transactions  redo-list - contains each transaction Ti for which a <Ti commit> log record exists  undo-list - contains each transaction Ti for which no <Ti commit> log record exists  The system then performs the following two steps (1) scan the log file in reverse order and for each log record of a transaction Ti in the undo-list perform an undo operation (2) scan the log file in forward order and for each log record of a transaction Ti in the redo-list perform a redo operation  To avoid a scan of the entire log file, special checkpoint operations can be performed periodically
  • 43. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 43May 12, 2017 Homework  Study the following chapters of the Database System Concepts book  chapter 14 - sections 14.1-14.10 - Transactions  chapter 15 - sections 15.1-15.11 - Concurrency Control  chapter 16 - sections 16.1-16.10 - Recovery System
  • 44. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 44May 12, 2017 Exercise 10  Query Processing and Query Optimisation
  • 45. Beat Signer - Department of Computer Science - bsigner@vub.ac.be 45May 12, 2017 References  A. Silberschatz, H. Korth and S. Sudarshan, Database System Concepts (Sixth Edition), McGraw-Hill, 2010
  • 46. 2 December 2005 Next Lecture NoSQL Databases