SlideShare a Scribd company logo
OVERVIEW OF
CONCURRENCY
CONTROL
Overview Of Concurrency
Control & Recovery in
Distributed Databases
Distributed Databases encounter a number of concurrency
control and recovery problems which are not present in
centralized databases. Some of them are listed below.
 These techniques are needed to deal with following problems -
>
 Dealing with multiple copies of data items :- The concurrency
control must maintain global consistency. Likewise the recovery
mechanism must recover all copies and maintain consistency
after recovery.
 Failure of individual sites :- Database availability must not be
affected due to the failure of one or two sites and the recovery
scheme must recover them before they are available for use.
 Failure of communication links :- This failure may create
network partition which would affect database availability even
though all database sites may be running.
 Distributed commit :- A transaction may be fragmented and they
may be executed by a number of sites. This require a two or
three-phase commit approach for transaction commit.
 Distributed deadlock :- Since transactions are processed at
multiple sites, two or more sites may get involved in deadlock.
This must be resolved in a distributed manner.
 .
Concurrency Control Based on
Distributed Copy of a Data Item
 Terminology :-
 Distinguished Copy : particular copy of
each data item, and the lock for this data
item is associated with it.
 Techniques :-
 Primary Site : The single Primary site is
designated as Coordinator site for all dbase
items. Hence, all Locking & Unlocking request
are sent here.
Concurrency Control and
Recovery
Communications neteork
Site 5
Site 1
Site 2
Site 4
Site 3
Primary site
Distributed Concurrency control based on a distributed copy of a data
item
Primary site technique: A single site is designated as a primary site
which serves as a coordinator for transaction management.
Concurrency Control and
Recovery
Transaction management: Concurrency control and commit are
managed by this site. In two phase locking, this site manages locking
and releasing data items. If all transactions follow two-phase policy at
all sites, then serializability is guaranteed.
Advantages: An extension to the centralized two phase locking so
implementation and management is simple. Data items are locked only
at one site but they can be accessed at any site.
Disadvantages: All transaction management activities go to primary
site which is likely to overload the site. If the primary site fails, the
entire system is inaccessible.
To aid recovery a backup site is designated which behaves as a shadow
of primary site. In case of primary site failure, backup site can act as
primary site.
Overview Of Concurrency Control & Recovery in Distributed Databases
cont…
Concurrency Control Based on
Distributed Copy of a Data Item
 Techniques (cont..):-
 Primary Site with Backup Site : All locking
information is maintained at both sites, in
case, Primary site fails the Backup site takes
over Primary site.
 Primary Copy : The distinguished copies of
different data items stored at different sites.
 Choosing New Coordinator Site in Case
of Failure: In case if coordinator fails, the
sites which are running chooses new
Coordinator
Concurrency Control and
Recovery
Primary Copy Technique: This method attempts to distribute the load
of lock coordination among various sites by having the distinguished
copies of different data items stored at different sites.
Advantages: Since primary copies are distributed at various sites, a
single site is not overloaded with locking and unlocking requests.
Disadvantages: Identification of a primary copy is complex. A
distributed directory must be maintained, possibly at all sites.
Concurrency Control and
Recovery
Recovery from a coordinator failure
In both approaches a coordinator site or copy may become unavailable.
This will require the selection of a new coordinator.
Primary site approach with no backup site: Aborts and restarts all
active transactions at all sites. Elects a new coordinator and initiates
transaction processing.
Primary site approach with backup site: Suspends all active
transactions, designates the backup site as the primary site and
identifies a new back up site. Primary site receives all transaction
management information to resume processing.
Primary and backup sites fail or no backup site: Use election process
to select a new coordinator site.
Introduction
 Concurrency control is the activity of
coordinating concurrent accesses to a
database in a multi-user database
management system (DBMS)
 Several problems
1. The lost update problem.
2. The temporary update problem
3. The incorrect summary problem
 Serializability Theory.
Transactions & Transaction
Management
 ACID Property is still must be notified
in DDBMS
 Atomicity; Consistency; Isolation;
Durability
 Transaction structures : Flat ; Nested
Begin_transaction
T1();
T2(); ……
End_transaction
Begin_transaction
Begin_transaction T1
Begin_transaction T2
T3(); ……
End_transaction T2
End_transaction T1
End_transaction
Transaction Processing
Centralized Transaction
Execution
Distributed Transaction
Execution
 Transaction Manager
 Data Manager
 Scheduler
DDBS Architecture Processing Operation
Anomaly in DB in Absence of
Concurrency Control
Scheduling Algorithms
 Modify concurrency control schemes for use in
distributed environment. There are 3 basic methods for
transaction concurrency control.
 Locking (two phase locking - 2PL).
 Timestamp ordering
 Optimistic
 Hybrid
Locking Protocols
 Majority Protocol
 Local lock manager at each site administers
lock and unlock requests for data items stored
at that site.
 When a transaction wishes to lock an un
replicated data item Q residing at site Si, a
message is sent to Si ‘s lock manager.
 If Q is locked in an incompatible mode, then the
request is delayed until it can be granted.
 When the lock request can be granted, the lock
manager sends a message back to the initiator
indicating that the lock request has been
granted.
Majority Protocol (Cont.)
 In case of replicated data
 If Q is replicated at n sites, then a lock request message must
be sent to more than half of the n sites in which Q is stored.
 The transaction does not operate on Q until it has obtained a
lock on a majority of the replicas of Q.
 When writing the data item, transaction performs writes on all
replicas.
 Benefit
 Can be used even when some sites are unavailable
 Drawback
 Requires 2(n/2 + 1) messages for handling lock requests, and
(n/2 + 1) messages for handling unlock requests.
 Potential for deadlock even with single item - e.g., each of 3
transactions may have locks on 1/3rd of the replicas of a data.
Biased Protocol
 Local lock manager at each site as in majority
protocol, however, requests for shared locks are
handled differently than requests for exclusive locks.
 Shared locks. When a transaction needs to lock data
item Q, it simply requests a lock on Q from the lock
manager at one site containing a replica of Q.
 Exclusive locks. When transaction needs to lock
data item Q, it requests a lock on Q from the lock
manager at all sites containing a replica of Q.
 Advantage - imposes less overhead on read
operations.
 Disadvantage - additional overhead on writes
Two Phase Locking
 Each transaction sets locks during
a growing phase and releases
them during a shrinking phase.
 all lock requests precede all
unlock requests
Two Phase Locking
 A transaction is two-phase locked
if:
 before reading x, it sets a read lock on x
 before writing x, it sets a write lock on x
 it holds each lock until after it executes
the corresponding operation
 after its first unlock operation, it requests
no new locks
Two Phase Locking
1. To grant a lock, the scheduler checks if a
conflicting lock has already been assigned, if
so, delay, otherwise set lock and grant it.
2. A lock cannot be released at least until the DM
acknowledges that the operation has been
performed.
3. Once the scheduler releases a lock for a txn, it
may not subsequently acquire any more locks
(on any item) for that txn.
2 Phase Locking (2PL)
 Centralized 2PL.
 Primary copy 2PL.
 Distributed 2PL.
 Voting 2PL.
Centralized 2PL
Distributed 2PL
Timestamp Ordering
 Timestamp (TS): a number associated
with each transaction
 Not necessarily real time
 Can be assigned by a logical counter
 Unique for each transaction
 Should be assigned in an increasing order
for each new transaction
Timestamp Ordering
 Timestamps associated with each database
item
 Read timestamp (RTS) : the largest timestamp of
the transactions that read the item so far
 Write timestamp (WTS) : the largest timestamp of
the transactions that write the item so far
 After each successful read/write of object O
by transaction T the timestamp is updated
 RTS(O) = max(RTS(O), TS(T))
 WTS(O) = max(WTS(O), TS(T))
 Whenever a transaction starts, it is given a
timestamp. This is so we can tell which order that
the transactions are supposed to be applied in. So
given two transactions that affect the same object,
the transaction that has the earlier timestamp is
meant to be applied before the other one. However,
if the wrong transaction is actually presented first, it
is aborted and must be restarted.
 Every object in the database has a read
timestamp, which is updated whenever the object's
data is read, and a write timestamp, which is
updated whenever the object's data is changed.
If a transaction wants to read an object,
 but the transaction started before the object's
write timestamp it means that something
changed the object's data after the transaction
started. In this case, the transaction is canceled
and must be restarted.
 and the transaction started after the object's write
timestamp, it means that it is safe to read the
object. In this case, if the transaction timestamp is
after the object's read timestamp, the read
timestamp is set to the transaction timestamp.
If a transaction wants to write to an
object,
 but the transaction started before the object's read
timestamp it means that something has had a look at the
object, and we assume it took a copy of the object's data. So
we can't write to the object as that would make any copied
data invalid, so the transaction is aborted and must be
restarted.
 and the transaction started before the object's write
timestamp it means that something has changed the object
since we started our transaction. In this case we use the
Thomas Write Rule and simply skip our write operation and
continue as normal; the transaction does not have to be
aborted or restarted
 otherwise, the transaction writes to the object, and the object's
write timestamp is set to the transaction's timestamp.
Timestamp Ordering
 Given a transaction T
 If T wants to read(X)
 If TS(T) < WTS(X) then read is rejected,
T has to abort
 Else, read is accepted and RTS(X)
updated.
 For a write-read conflict, which
direction does this protocol allow?
Timestamp Ordering
 If T wants to write(X)
 If TS(T) < RTS(X) then write is rejected,
T has to abort
 If TS(T) < WTS(X) then write is rejected,
T has to abort
 Else, allow the write, and update WTS(X)
accordingly
A Secure Concurrency Control Protocol
WRITE Algorithm
On Data Item x, Issued by Sub-Transaction Si, with Time-Stamp Tsi
( RTs(x) > Tsi )
{
Abort ( Si ) ;
}
ElseIf ( WTs(x) > Tsi )
{
Ignore ( Si ) ;
}
ElseIf( Lv (x) == Lv (Si ) ) /* Lv (x)&Lv (Si ) is security level of data item x & transact ion Si */
{
WritelockTo( x ) ;
Execution( x ) ;
WTs(x) = Tsi ;
Update DAT to Tsi ;
}
Else
{
Abort( Si ) ;/ * access denied due to security */
}
A Secure Concurrency Control Protocol
READ Algorithm
On Data Item x, Issued by Sub-Transaction Si, with Time-Stamp Tsi
If (WTs(x) > Tsi )
{
Abort( Si );
Rollback( Si );
}
ElseIf( Lv (x) <= Lv (Si ) )
{
ReadlockTo( x );
ExecuteOn( x );
RTs(x) = Tsi ;
Update DAT to Tsi ;
}
Else
{
Abort( Si );
Rollback( Si );
}
Hybrid
 Three basic technique and each can be used for rw or
ww scheduling or both.
 Schedulers can be centralized or distributed.
 Replicated data can be handled in three ways (Do
Nothing, Primary Copy, Voting).
 System R*
Use a 2PL scheduler for rw and ww synchronization.
The schedulers are distributed at the DM's. Replication
is handled by the do nothing approach.
 Distributed INGRES
INGRES uses primary copy for replication.

More Related Content

Similar to concurrency control.ppt (20)

PPTX
Concurrency Control
Nishant Munjal
 
PPTX
Distributed computing
Swetha544947
 
PPTX
Presentation on Transaction
Rahul Prajapati
 
PPTX
DBMS Presentation.pptx
PravinBhargav1
 
PPTX
DBMS Pravin concurrency control technique.pptx
PravinBhargav1
 
PPT
Concurrency control ms neeti
neeti arora
 
PPT
Concurrency control ms neeti
neeti arora
 
PDF
F017213747
IOSR Journals
 
PDF
Design & Development of an Advanced Database Management System Using Multiver...
IOSR Journals
 
PDF
F017213747
IOSR Journals
 
PPT
Ch17 OS
C.U
 
PPT
OSCh17
Joe Christensen
 
DOCX
Locking base concurrency control
Prakash Poudel
 
PDF
Concurrency note.pdf
BijayNag1
 
PPTX
DBMS UNIT V.pptx
NIVETHA37590
 
PDF
Advanced database chapter three PowerPoint
afendimohammed288
 
PPT
Concurrency Control power point presentations.ppt
luffy0monkey11
 
PPTX
Understanding Transactions in Databases.pptx
Mahmud Hasan Tanvir
 
PPTX
Transaction management transparencies
Mohamed Zeinelabdeen Abdelgader Farh jber
 
Concurrency Control
Nishant Munjal
 
Distributed computing
Swetha544947
 
Presentation on Transaction
Rahul Prajapati
 
DBMS Presentation.pptx
PravinBhargav1
 
DBMS Pravin concurrency control technique.pptx
PravinBhargav1
 
Concurrency control ms neeti
neeti arora
 
Concurrency control ms neeti
neeti arora
 
F017213747
IOSR Journals
 
Design & Development of an Advanced Database Management System Using Multiver...
IOSR Journals
 
F017213747
IOSR Journals
 
Ch17 OS
C.U
 
Locking base concurrency control
Prakash Poudel
 
Concurrency note.pdf
BijayNag1
 
DBMS UNIT V.pptx
NIVETHA37590
 
Advanced database chapter three PowerPoint
afendimohammed288
 
Concurrency Control power point presentations.ppt
luffy0monkey11
 
Understanding Transactions in Databases.pptx
Mahmud Hasan Tanvir
 
Transaction management transparencies
Mohamed Zeinelabdeen Abdelgader Farh jber
 

Recently uploaded (20)

PPTX
Precooling and Refrigerated storage.pptx
ThongamSunita
 
PDF
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
PDF
Digital water marking system project report
Kamal Acharya
 
DOCX
Engineering Geology Field Report to Malekhu .docx
justprashant567
 
PDF
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
PDF
Module - 4 Machine Learning -22ISE62.pdf
Dr. Shivashankar
 
PPTX
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
 
PPSX
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
PDF
Bayesian Learning - Naive Bayes Algorithm
Sharmila Chidaravalli
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PDF
LLC CM NCP1399 SIMPLIS MODEL MANUAL.PDF
ssuser1be9ce
 
PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
PDF
NTPC PATRATU Summer internship report.pdf
hemant03701
 
PPTX
Functions in Python Programming Language
BeulahS2
 
PDF
NFPA 10 - Estandar para extintores de incendios portatiles (ed.22 ENG).pdf
Oscar Orozco
 
PDF
Module - 5 Machine Learning-22ISE62.pdf
Dr. Shivashankar
 
PPTX
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
PDF
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENT
samueljackson3773
 
PDF
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
PDF
A Brief Introduction About Robert Paul Hardee
Robert Paul Hardee
 
Precooling and Refrigerated storage.pptx
ThongamSunita
 
Submit Your Papers-International Journal on Cybernetics & Informatics ( IJCI)
IJCI JOURNAL
 
Digital water marking system project report
Kamal Acharya
 
Engineering Geology Field Report to Malekhu .docx
justprashant567
 
20ES1152 Programming for Problem Solving Lab Manual VRSEC.pdf
Ashutosh Satapathy
 
Module - 4 Machine Learning -22ISE62.pdf
Dr. Shivashankar
 
Unit_I Functional Units, Instruction Sets.pptx
logaprakash9
 
OOPS Concepts in Python and Exception Handling
Dr. A. B. Shinde
 
Bayesian Learning - Naive Bayes Algorithm
Sharmila Chidaravalli
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
LLC CM NCP1399 SIMPLIS MODEL MANUAL.PDF
ssuser1be9ce
 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
NTPC PATRATU Summer internship report.pdf
hemant03701
 
Functions in Python Programming Language
BeulahS2
 
NFPA 10 - Estandar para extintores de incendios portatiles (ed.22 ENG).pdf
Oscar Orozco
 
Module - 5 Machine Learning-22ISE62.pdf
Dr. Shivashankar
 
Introduction to File Transfer Protocol with commands in FTP
BeulahS2
 
PROGRAMMING REQUESTS/RESPONSES WITH GREATFREE IN THE CLOUD ENVIRONMENT
samueljackson3773
 
MODULE-5 notes [BCG402-CG&V] PART-B.pdf
Alvas Institute of Engineering and technology, Moodabidri
 
A Brief Introduction About Robert Paul Hardee
Robert Paul Hardee
 
Ad

concurrency control.ppt

  • 2. Overview Of Concurrency Control & Recovery in Distributed Databases Distributed Databases encounter a number of concurrency control and recovery problems which are not present in centralized databases. Some of them are listed below.  These techniques are needed to deal with following problems - >  Dealing with multiple copies of data items :- The concurrency control must maintain global consistency. Likewise the recovery mechanism must recover all copies and maintain consistency after recovery.  Failure of individual sites :- Database availability must not be affected due to the failure of one or two sites and the recovery scheme must recover them before they are available for use.  Failure of communication links :- This failure may create network partition which would affect database availability even though all database sites may be running.  Distributed commit :- A transaction may be fragmented and they may be executed by a number of sites. This require a two or three-phase commit approach for transaction commit.  Distributed deadlock :- Since transactions are processed at multiple sites, two or more sites may get involved in deadlock. This must be resolved in a distributed manner.  .
  • 3. Concurrency Control Based on Distributed Copy of a Data Item  Terminology :-  Distinguished Copy : particular copy of each data item, and the lock for this data item is associated with it.  Techniques :-  Primary Site : The single Primary site is designated as Coordinator site for all dbase items. Hence, all Locking & Unlocking request are sent here.
  • 4. Concurrency Control and Recovery Communications neteork Site 5 Site 1 Site 2 Site 4 Site 3 Primary site Distributed Concurrency control based on a distributed copy of a data item Primary site technique: A single site is designated as a primary site which serves as a coordinator for transaction management.
  • 5. Concurrency Control and Recovery Transaction management: Concurrency control and commit are managed by this site. In two phase locking, this site manages locking and releasing data items. If all transactions follow two-phase policy at all sites, then serializability is guaranteed. Advantages: An extension to the centralized two phase locking so implementation and management is simple. Data items are locked only at one site but they can be accessed at any site. Disadvantages: All transaction management activities go to primary site which is likely to overload the site. If the primary site fails, the entire system is inaccessible. To aid recovery a backup site is designated which behaves as a shadow of primary site. In case of primary site failure, backup site can act as primary site.
  • 6. Overview Of Concurrency Control & Recovery in Distributed Databases cont… Concurrency Control Based on Distributed Copy of a Data Item  Techniques (cont..):-  Primary Site with Backup Site : All locking information is maintained at both sites, in case, Primary site fails the Backup site takes over Primary site.  Primary Copy : The distinguished copies of different data items stored at different sites.  Choosing New Coordinator Site in Case of Failure: In case if coordinator fails, the sites which are running chooses new Coordinator
  • 7. Concurrency Control and Recovery Primary Copy Technique: This method attempts to distribute the load of lock coordination among various sites by having the distinguished copies of different data items stored at different sites. Advantages: Since primary copies are distributed at various sites, a single site is not overloaded with locking and unlocking requests. Disadvantages: Identification of a primary copy is complex. A distributed directory must be maintained, possibly at all sites.
  • 8. Concurrency Control and Recovery Recovery from a coordinator failure In both approaches a coordinator site or copy may become unavailable. This will require the selection of a new coordinator. Primary site approach with no backup site: Aborts and restarts all active transactions at all sites. Elects a new coordinator and initiates transaction processing. Primary site approach with backup site: Suspends all active transactions, designates the backup site as the primary site and identifies a new back up site. Primary site receives all transaction management information to resume processing. Primary and backup sites fail or no backup site: Use election process to select a new coordinator site.
  • 9. Introduction  Concurrency control is the activity of coordinating concurrent accesses to a database in a multi-user database management system (DBMS)  Several problems 1. The lost update problem. 2. The temporary update problem 3. The incorrect summary problem  Serializability Theory.
  • 10. Transactions & Transaction Management  ACID Property is still must be notified in DDBMS  Atomicity; Consistency; Isolation; Durability  Transaction structures : Flat ; Nested Begin_transaction T1(); T2(); …… End_transaction Begin_transaction Begin_transaction T1 Begin_transaction T2 T3(); …… End_transaction T2 End_transaction T1 End_transaction
  • 13. Distributed Transaction Execution  Transaction Manager  Data Manager  Scheduler DDBS Architecture Processing Operation
  • 14. Anomaly in DB in Absence of Concurrency Control
  • 15. Scheduling Algorithms  Modify concurrency control schemes for use in distributed environment. There are 3 basic methods for transaction concurrency control.  Locking (two phase locking - 2PL).  Timestamp ordering  Optimistic  Hybrid
  • 16. Locking Protocols  Majority Protocol  Local lock manager at each site administers lock and unlock requests for data items stored at that site.  When a transaction wishes to lock an un replicated data item Q residing at site Si, a message is sent to Si ‘s lock manager.  If Q is locked in an incompatible mode, then the request is delayed until it can be granted.  When the lock request can be granted, the lock manager sends a message back to the initiator indicating that the lock request has been granted.
  • 17. Majority Protocol (Cont.)  In case of replicated data  If Q is replicated at n sites, then a lock request message must be sent to more than half of the n sites in which Q is stored.  The transaction does not operate on Q until it has obtained a lock on a majority of the replicas of Q.  When writing the data item, transaction performs writes on all replicas.  Benefit  Can be used even when some sites are unavailable  Drawback  Requires 2(n/2 + 1) messages for handling lock requests, and (n/2 + 1) messages for handling unlock requests.  Potential for deadlock even with single item - e.g., each of 3 transactions may have locks on 1/3rd of the replicas of a data.
  • 18. Biased Protocol  Local lock manager at each site as in majority protocol, however, requests for shared locks are handled differently than requests for exclusive locks.  Shared locks. When a transaction needs to lock data item Q, it simply requests a lock on Q from the lock manager at one site containing a replica of Q.  Exclusive locks. When transaction needs to lock data item Q, it requests a lock on Q from the lock manager at all sites containing a replica of Q.  Advantage - imposes less overhead on read operations.  Disadvantage - additional overhead on writes
  • 19. Two Phase Locking  Each transaction sets locks during a growing phase and releases them during a shrinking phase.  all lock requests precede all unlock requests
  • 20. Two Phase Locking  A transaction is two-phase locked if:  before reading x, it sets a read lock on x  before writing x, it sets a write lock on x  it holds each lock until after it executes the corresponding operation  after its first unlock operation, it requests no new locks
  • 21. Two Phase Locking 1. To grant a lock, the scheduler checks if a conflicting lock has already been assigned, if so, delay, otherwise set lock and grant it. 2. A lock cannot be released at least until the DM acknowledges that the operation has been performed. 3. Once the scheduler releases a lock for a txn, it may not subsequently acquire any more locks (on any item) for that txn.
  • 22. 2 Phase Locking (2PL)  Centralized 2PL.  Primary copy 2PL.  Distributed 2PL.  Voting 2PL.
  • 25. Timestamp Ordering  Timestamp (TS): a number associated with each transaction  Not necessarily real time  Can be assigned by a logical counter  Unique for each transaction  Should be assigned in an increasing order for each new transaction
  • 26. Timestamp Ordering  Timestamps associated with each database item  Read timestamp (RTS) : the largest timestamp of the transactions that read the item so far  Write timestamp (WTS) : the largest timestamp of the transactions that write the item so far  After each successful read/write of object O by transaction T the timestamp is updated  RTS(O) = max(RTS(O), TS(T))  WTS(O) = max(WTS(O), TS(T))
  • 27.  Whenever a transaction starts, it is given a timestamp. This is so we can tell which order that the transactions are supposed to be applied in. So given two transactions that affect the same object, the transaction that has the earlier timestamp is meant to be applied before the other one. However, if the wrong transaction is actually presented first, it is aborted and must be restarted.  Every object in the database has a read timestamp, which is updated whenever the object's data is read, and a write timestamp, which is updated whenever the object's data is changed.
  • 28. If a transaction wants to read an object,  but the transaction started before the object's write timestamp it means that something changed the object's data after the transaction started. In this case, the transaction is canceled and must be restarted.  and the transaction started after the object's write timestamp, it means that it is safe to read the object. In this case, if the transaction timestamp is after the object's read timestamp, the read timestamp is set to the transaction timestamp.
  • 29. If a transaction wants to write to an object,  but the transaction started before the object's read timestamp it means that something has had a look at the object, and we assume it took a copy of the object's data. So we can't write to the object as that would make any copied data invalid, so the transaction is aborted and must be restarted.  and the transaction started before the object's write timestamp it means that something has changed the object since we started our transaction. In this case we use the Thomas Write Rule and simply skip our write operation and continue as normal; the transaction does not have to be aborted or restarted  otherwise, the transaction writes to the object, and the object's write timestamp is set to the transaction's timestamp.
  • 30. Timestamp Ordering  Given a transaction T  If T wants to read(X)  If TS(T) < WTS(X) then read is rejected, T has to abort  Else, read is accepted and RTS(X) updated.  For a write-read conflict, which direction does this protocol allow?
  • 31. Timestamp Ordering  If T wants to write(X)  If TS(T) < RTS(X) then write is rejected, T has to abort  If TS(T) < WTS(X) then write is rejected, T has to abort  Else, allow the write, and update WTS(X) accordingly
  • 32. A Secure Concurrency Control Protocol WRITE Algorithm On Data Item x, Issued by Sub-Transaction Si, with Time-Stamp Tsi ( RTs(x) > Tsi ) { Abort ( Si ) ; } ElseIf ( WTs(x) > Tsi ) { Ignore ( Si ) ; } ElseIf( Lv (x) == Lv (Si ) ) /* Lv (x)&Lv (Si ) is security level of data item x & transact ion Si */ { WritelockTo( x ) ; Execution( x ) ; WTs(x) = Tsi ; Update DAT to Tsi ; } Else { Abort( Si ) ;/ * access denied due to security */ }
  • 33. A Secure Concurrency Control Protocol READ Algorithm On Data Item x, Issued by Sub-Transaction Si, with Time-Stamp Tsi If (WTs(x) > Tsi ) { Abort( Si ); Rollback( Si ); } ElseIf( Lv (x) <= Lv (Si ) ) { ReadlockTo( x ); ExecuteOn( x ); RTs(x) = Tsi ; Update DAT to Tsi ; } Else { Abort( Si ); Rollback( Si ); }
  • 34. Hybrid  Three basic technique and each can be used for rw or ww scheduling or both.  Schedulers can be centralized or distributed.  Replicated data can be handled in three ways (Do Nothing, Primary Copy, Voting).  System R* Use a 2PL scheduler for rw and ww synchronization. The schedulers are distributed at the DM's. Replication is handled by the do nothing approach.  Distributed INGRES INGRES uses primary copy for replication.