SlideShare une entreprise Scribd logo
1  sur  26
K.Balamurugan
M.Tech-CSE-1st year
ADMS Presentation
Pondicherry university
Distributed Database System
- Distributed Transaction
Content:
 Introduction to Distributed transaction
 Distributed Transaction Model
 Commit Protocols
 Handling Failures
 Concurrency control and Recovery in distributed
Environments
Once again what is distributed
database?
 A distributed database system consists of
loosely coupled sites that share no physical
component
 Database systems that run on each site are
independent of each other
 Transactions may access data at one or more sites
 Each site has a 1.Transaction Manager
2. transaction coordinator
 transaction coordinator -Starting the execution of
transactions that originate at the site.
 Transaction Manager-Participating in coordinating
the concurrent execution of the transactions
executing at that site.
Transaction System
 Access to the various data items in a distributed
system is usually accomplished through
transactions, which must preserve the ACID
properties
 The local transactions are those that access
and update data in only one local database
 The global transactions are those that access
and update data in several local databases.
Distributed Transaction System
Architecture
Abstract model of a transaction
system
 Each site has its own local transaction manager,
whose function is to ensure the ACID properties of
those transactions that execute at that site
 The transaction manager manages the execution of
those transactions (or sub-transactions) that access
data stored in a local site. Note that each such
transaction may be either a local transaction (that is, a
transaction that executes at (only that site) or part of a
global transaction
 The transaction coordinator coordinates the
execution of the various transactions (both local and
global) initiated at that site.
Abstract model of a transaction
system
 Each transaction manager is responsible for
Maintaining a log for recovery purposes
 the coordinator is responsible for
• Starting the execution of the transaction
• Breaking the transaction into a number of sub
transactions and distributing these sub
transactions to the appropriate sites for execution
• Coordinating the termination of the transaction,
which may result in the transaction being
committed at all sites or aborted at all sites
System Failure Modes
 A distributed system may suffer from the same
types of failure that a centralized system does (for
example, software errors, hardware errors, or disk
crashes)
 distributed environment have following unique
failures. They are :
• Failure of a site
• Loss of messages
• Failure of a communication link
• Network partition
Commit Protocols
 To ensure atomicity property, the transaction
coordinator of T must execute a commit protocol.
 There are 2 types of commit protocols:
 two-phase commit protocol (2PC)
three-phase commit protocol (3PC)
Two-Phase Commit protocol
 Normal operation, then describe how it handles
failures and finally how it carries out recovery and
concurrency control.
 Let T be a transaction initiated at site Si, and let the
transaction coordinator at Si be Ci
 Phase 1: Obtaining a Decision
 Coordinator asks all participants to prepare to commit
transaction Ti .
 Ci adds the records <prepare T > to the log and forces log to
stable storage
 sends prepare T messages to all sites at which T executed
 Upon receiving message, transaction manager at site
determines if it can commit the transaction
 if not, add a record <no T > to the log and send abort T
message to Ci
 if the transaction can be committed, then:
 add the record <ready T > to the log
 force all records for T to stable storage
Phase 2: Recording the Decision
 T can be committed of Ci received a ready T
message from all the participating sites: otherwise
T must be aborted.
 Coordinator adds a decision record, <commit T >
or <abort T >, to the log and forces record onto
stable storage. Once the record stable storage it is
irrevocable (even if failures occur)
 Coordinator sends a message to each participant
informing it of the decision (commit or abort)
 Participants take appropriate action locally.
Handling of Failures - Site Failure
When site Si recovers, it examines its log to determine the fate of
transactions active at the time of the failure.
 Log contain <commit T> record: site executes redo (T)
 Log contains <abort T> record: site executes undo (T)
 Log contains <ready T> record: site must consult Ci to determine the
fate of T.
 If T committed, redo (T)
 If T aborted, undo (T)
 The log contains no control records concerning T
 implies that Sk failed before responding to the prepare T message
from Ci
 Sk must execute undo (T)
Handling of Failures- Coordinator
Failure
 If coordinator fails while the commit protocol for T is executing then
participating sites must decide on T ’s fate:
• If an active site contains a <commit T > record in its log, then T must
be committed.
• If an active site contains an <abort T > record in its log, then T must
be aborted.
• If some active participating site does not contain a <ready T > record
in its log, then the failed coordinator Ci cannot have decided to
commit T .
• Can therefore abort T .
• If none of the above cases holds, then all active sites must have a
<ready T > record in their logs, but no additional control records (such
as <abort T > of <commit T >).
• In this case active sites must wait for Ci to recover, to find
decision.
 Blocking problem : active sites may have to wait for failed
coordinator to recover.
Recovery and Concurrency
Control
 In-doubt transactions have a <ready T>, but
neither a <commit T>, nor an <abort T> log record.
 The recovering site must determine the commit-
abort status of such transactions by contacting
other sites; this can slow and potentially block
recovery.
 Recovery algorithms can note lock information in
the log.
 Instead of <ready T>, write out <ready T, L> L = list of
locks held by T when the log is written (read locks can be
omitted).
 For every in-doubt transaction T, all the locks noted in the
<ready T, L> log record are reacquired.
 After lock reacquisition, transaction processing can
resume; the commit or rollback of in-doubt
transactions is performed concurrently with the
Three-Phase Commit
 The three-phase commit (3PC) protocol is an
extension of the two-phase commit protocol that
avoids the blocking problem.
 protocol avoids blocking by introducing an extra third
phase where multiple sites are involved in the
decision to commit.
 coordinator first ensures that at least k other sites
know that it intended to commit the transaction. If the
coordinator fails, the remaining sites first select a new
coordinator.
 The new coordinator restarts the third phase of the
protocol if some site knew that the old coordinator
intended to commit the transaction. Otherwise the
new coordinator aborts the transaction.
Concurrency Control in Distributed
Databases
 commit protocol to ensure global transaction
atomicity.
 The protocols we describe in this section require
updates to be done on all replicas of a data item.
If any site containing a replica of a data item has
failed, updates to the data item cannot be
processed.
 In this we describe protocols that can continue
transaction processing even if some sites or links
have failed, thereby providing high availability
Locking Protocols
 The various locking protocols can be used in a
distributed environment. The only change that
needs to be incorporated is in the way the lock
manager deals with replicated data. We present 2
possible schemes:
1. Single Lock-Manager Approach
2. Distributed Lock Manager
Single-Lock-Manager Approach
 System maintains a single lock manager that
resides in a single chosen site, say Si
 When a transaction needs to lock a data item, it
sends a lock request to Si and lock manager
determines whether the lock can be granted
immediately
 If yes, lock manager sends a message to the site which
initiated the request
 If no, request is delayed until it can be granted, at which
time a message is sent to the initiating site
Single-Lock-Manager
Approach
 The transaction can read the data item from any
one of the sites at which a replica of the data item
resides.
 Writes must be performed on all replicas of a data
item
 Advantages of scheme:
 Simple implementation
 Simple deadlock handling
 Disadvantages of scheme are:
 Bottleneck: lock manager site becomes a bottleneck
 Vulnerability: system is vulnerable to lock manager site
failure.
Distributed Lock Manager
 Distributed lock-manager approach, in which the lock-
manager function is distributed over several sites.
 When a transaction wishes to lock data item Q, which
is not replicated and resides at site Si,a message is
sent to the lock manager at site Si requesting a
lock(in a particular lock mode). If data item Q is
locked in an incompatible mode, then the request is
delayed until it can be granted.
 Once it has determined that the lock request can be
granted,the lock manager sends a message back to
the initiator indicating that it has granted the lock
request.
 Advantage: work is distributed and
 Disadvantage: deadlock detection is more complicated
Distributed Lock Manager
 There are several alternative ways of dealing with replication of
data items:
 Primary copy
 Majority protocol
 Biased protocol
 Primary Copy:
 Choose one replica of data item to be the primary copy.
 Site containing the replica is called the primary site for that data item
 Different data items can have different primary sites
 When a transaction needs to lock a data item Q, it requests a
lock at the primary site of Q.
 Implicitly gets lock on all replicas of the data item
 Benefit
 Concurrency control for replicated data handled similarly to replicated data
- simple implementation.
 Drawback
 If the primary site of Q fails, Q is inaccessible even though other
Majority Protocol
 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.
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
Timestamp
 Timestamp based concurrency-control protocols
can be used in distributed systems
 Each transaction must be given a unique
timestamp
 Main problem: how to generate a timestamp in a
distributed fashion
 Each site generates a unique local timestamp
using either a logical counter or the local clock.
 Global unique timestamp is obtained by
concatenating the unique local timestamp with
the unique identifier.
Timestamp
Timestamp
 A site with a slow clock will assign smaller
timestamps
 Still logically correct: serializability not affected
 But: “disadvantages” transactions
 To fix this problem
 Define within each site Si a logical clock (LCi ), which
generates the unique local timestamp
 Require that Si advance its logical clock whenever a
request is received from a transaction Ti with timestamp <
x,y > and x is greater that the current value of LCi.
 In this case, site Si advances its logical clock to the value x
+ 1.

Contenu connexe

Tendances

Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency controlBinte fatima
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems SHATHAN
 
Optimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed SystemsOptimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed Systemsmridul mishra
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handlingSuraj Kumar
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMSkoolkampus
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESAAKANKSHA JAIN
 
Database concurrency control &amp; recovery (1)
Database concurrency control &amp; recovery (1)Database concurrency control &amp; recovery (1)
Database concurrency control &amp; recovery (1)Rashid Khan
 
Distribution transparency and Distributed transaction
Distribution transparency and Distributed transactionDistribution transparency and Distributed transaction
Distribution transparency and Distributed transactionshraddha mane
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system modelHarshad Umredkar
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency ControlAli Usman
 
19. Distributed Databases in DBMS
19. Distributed Databases in DBMS19. Distributed Databases in DBMS
19. Distributed Databases in DBMSkoolkampus
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDHIVYADEVAKI
 

Tendances (20)

Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
Distributed concurrency control
Distributed concurrency controlDistributed concurrency control
Distributed concurrency control
 
Distributed Transaction
Distributed TransactionDistributed Transaction
Distributed Transaction
 
Distributed deadlock
Distributed deadlockDistributed deadlock
Distributed deadlock
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems
 
Optimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed SystemsOptimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed Systems
 
deadlock handling
deadlock handlingdeadlock handling
deadlock handling
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
 
Database concurrency control &amp; recovery (1)
Database concurrency control &amp; recovery (1)Database concurrency control &amp; recovery (1)
Database concurrency control &amp; recovery (1)
 
Distribution transparency and Distributed transaction
Distribution transparency and Distributed transactionDistribution transparency and Distributed transaction
Distribution transparency and Distributed transaction
 
Distributed Coordination-Based Systems
Distributed Coordination-Based SystemsDistributed Coordination-Based Systems
Distributed Coordination-Based Systems
 
distributed Computing system model
distributed Computing system modeldistributed Computing system model
distributed Computing system model
 
Database ,11 Concurrency Control
Database ,11 Concurrency ControlDatabase ,11 Concurrency Control
Database ,11 Concurrency Control
 
19. Distributed Databases in DBMS
19. Distributed Databases in DBMS19. Distributed Databases in DBMS
19. Distributed Databases in DBMS
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
 
Distributed database
Distributed databaseDistributed database
Distributed database
 
Deadlock Avoidance in Operating System
Deadlock Avoidance in Operating SystemDeadlock Avoidance in Operating System
Deadlock Avoidance in Operating System
 

En vedette

Transactions (Distributed computing)
Transactions (Distributed computing)Transactions (Distributed computing)
Transactions (Distributed computing)Sri Prasanna
 
Concurrency (Distributed computing)
Concurrency (Distributed computing)Concurrency (Distributed computing)
Concurrency (Distributed computing)Sri Prasanna
 
9 fault-tolerance
9 fault-tolerance9 fault-tolerance
9 fault-tolerance4020132038
 
02. Fault Tolerance Pattern 위한 mindset
02. Fault Tolerance Pattern 위한 mindset02. Fault Tolerance Pattern 위한 mindset
02. Fault Tolerance Pattern 위한 mindseteva
 
transaction-management
transaction-managementtransaction-management
transaction-managementShami Zama
 
CS 542 -- Concurrency Control, Distributed Commit
CS 542 -- Concurrency Control, Distributed CommitCS 542 -- Concurrency Control, Distributed Commit
CS 542 -- Concurrency Control, Distributed CommitJ Singh
 
DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)Gaurav Solanki
 
Lecture7 Transactionmanagement Concurrencycontrol
Lecture7 Transactionmanagement ConcurrencycontrolLecture7 Transactionmanagement Concurrencycontrol
Lecture7 Transactionmanagement Concurrencycontrolguest800d4
 
Atomic Service Transactions
Atomic Service Transactions Atomic Service Transactions
Atomic Service Transactions WSO2
 
Deadlock Detection
Deadlock DetectionDeadlock Detection
Deadlock DetectionStuart Joy
 
Distributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsDistributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsEnsar Basri Kahveci
 
Deadlock detection in distributed systems
Deadlock detection in distributed systemsDeadlock detection in distributed systems
Deadlock detection in distributed systemsReza Ramezani
 
Deadlock detection
Deadlock detectionDeadlock detection
Deadlock detectionNadia Nahar
 
Deadlock Detection
Deadlock DetectionDeadlock Detection
Deadlock DetectionPOOJA MEHTA
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency ControlRavimuthurajan
 
4. concurrency control
4. concurrency control4. concurrency control
4. concurrency controlAbDul ThaYyal
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency controlAnand Grewal
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed SystemsRupsee
 

En vedette (20)

Transactions (Distributed computing)
Transactions (Distributed computing)Transactions (Distributed computing)
Transactions (Distributed computing)
 
Concurrency (Distributed computing)
Concurrency (Distributed computing)Concurrency (Distributed computing)
Concurrency (Distributed computing)
 
9 fault-tolerance
9 fault-tolerance9 fault-tolerance
9 fault-tolerance
 
02. Fault Tolerance Pattern 위한 mindset
02. Fault Tolerance Pattern 위한 mindset02. Fault Tolerance Pattern 위한 mindset
02. Fault Tolerance Pattern 위한 mindset
 
transaction-management
transaction-managementtransaction-management
transaction-management
 
CS 542 -- Concurrency Control, Distributed Commit
CS 542 -- Concurrency Control, Distributed CommitCS 542 -- Concurrency Control, Distributed Commit
CS 542 -- Concurrency Control, Distributed Commit
 
DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)DBMS (Deadlock, deadlock prevention, 2phase locking)
DBMS (Deadlock, deadlock prevention, 2phase locking)
 
Lecture7 Transactionmanagement Concurrencycontrol
Lecture7 Transactionmanagement ConcurrencycontrolLecture7 Transactionmanagement Concurrencycontrol
Lecture7 Transactionmanagement Concurrencycontrol
 
Atomic Service Transactions
Atomic Service Transactions Atomic Service Transactions
Atomic Service Transactions
 
Deadlock Detection
Deadlock DetectionDeadlock Detection
Deadlock Detection
 
Distributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere MortalsDistributed Systems Theory for Mere Mortals
Distributed Systems Theory for Mere Mortals
 
Deadlock detection in distributed systems
Deadlock detection in distributed systemsDeadlock detection in distributed systems
Deadlock detection in distributed systems
 
Deadlock detection
Deadlock detectionDeadlock detection
Deadlock detection
 
Acid properties
Acid propertiesAcid properties
Acid properties
 
Deadlock Detection
Deadlock DetectionDeadlock Detection
Deadlock Detection
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency Control
 
4. concurrency control
4. concurrency control4. concurrency control
4. concurrency control
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency control
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 

Similaire à Distributed datababase Transaction and concurrency control

3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-queryM Rezaur Rahman
 
Ch17 OS
Ch17 OSCh17 OS
Ch17 OSC.U
 
Chapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationChapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationWayne Jones Jnr
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.pptBikalAdhikari4
 
Top schools in ghaziabad
Top schools in ghaziabadTop schools in ghaziabad
Top schools in ghaziabadEdhole.com
 
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...DHANUSHKUMARKS
 
Introduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryIntroduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryZainab Almugbel
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsSachin Chauhan
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on TransactionRahul Prajapati
 
Distributed databases,types of database
Distributed databases,types of databaseDistributed databases,types of database
Distributed databases,types of databaseBoomadevi Shanmugam
 
Concurrency control
Concurrency  controlConcurrency  control
Concurrency controlJaved Khan
 
Transaction management
Transaction managementTransaction management
Transaction managementArchanaMani2
 
Management of Distributed Transactions
Management of Distributed TransactionsManagement of Distributed Transactions
Management of Distributed TransactionsAnkita Dubey
 

Similaire à Distributed datababase Transaction and concurrency control (20)

3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query3 distributed transactions-cocurrency-query
3 distributed transactions-cocurrency-query
 
Ch17 OS
Ch17 OSCh17 OS
Ch17 OS
 
OS_Ch17
OS_Ch17OS_Ch17
OS_Ch17
 
OSCh17
OSCh17OSCh17
OSCh17
 
Chapter 18 - Distributed Coordination
Chapter 18 - Distributed CoordinationChapter 18 - Distributed Coordination
Chapter 18 - Distributed Coordination
 
concurrency control.ppt
concurrency control.pptconcurrency control.ppt
concurrency control.ppt
 
DBMS UNIT V.pptx
DBMS UNIT V.pptxDBMS UNIT V.pptx
DBMS UNIT V.pptx
 
Top schools in ghaziabad
Top schools in ghaziabadTop schools in ghaziabad
Top schools in ghaziabad
 
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9...
 
Transaction management transparencies
Transaction management transparenciesTransaction management transparencies
Transaction management transparencies
 
Introduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theoryIntroduction to transaction processing concepts and theory
Introduction to transaction processing concepts and theory
 
Managing transactions 11g release 1 (10.3
Managing transactions   11g release 1 (10.3Managing transactions   11g release 1 (10.3
Managing transactions 11g release 1 (10.3
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit Protocols
 
dos.ppt.pptx
dos.ppt.pptxdos.ppt.pptx
dos.ppt.pptx
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on Transaction
 
Distributed databases,types of database
Distributed databases,types of databaseDistributed databases,types of database
Distributed databases,types of database
 
Concurrency control
Concurrency  controlConcurrency  control
Concurrency control
 
Transaction management
Transaction managementTransaction management
Transaction management
 
Concurrency Control
Concurrency ControlConcurrency Control
Concurrency Control
 
Management of Distributed Transactions
Management of Distributed TransactionsManagement of Distributed Transactions
Management of Distributed Transactions
 

Plus de balamurugan.k Kalibalamurugan (10)

Problem definition
Problem definitionProblem definition
Problem definition
 
Description logic
Description logicDescription logic
Description logic
 
Software testing
Software testingSoftware testing
Software testing
 
Window ce
Window ceWindow ce
Window ce
 
Radius1
Radius1Radius1
Radius1
 
A multi criteria evaluation of environmental databases using hasse
A multi criteria evaluation of environmental databases using hasseA multi criteria evaluation of environmental databases using hasse
A multi criteria evaluation of environmental databases using hasse
 
Simple object access protocol(soap )
Simple object access protocol(soap )Simple object access protocol(soap )
Simple object access protocol(soap )
 
Tamil OCR using Tesseract OCR Engine
Tamil OCR using Tesseract OCR EngineTamil OCR using Tesseract OCR Engine
Tamil OCR using Tesseract OCR Engine
 
Security monitoring and auditing
Security monitoring and auditingSecurity monitoring and auditing
Security monitoring and auditing
 
Object oriented framework
Object oriented frameworkObject oriented framework
Object oriented framework
 

Dernier

Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfOverkill Security
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)Wonjun Hwang
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxMarkSteadman7
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingScyllaDB
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Paige Cruz
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityVictorSzoltysek
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiRaviKumarDaparthi
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data SciencePaolo Missier
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 

Dernier (20)

Microsoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdfMicrosoft BitLocker Bypass Attack Method.pdf
Microsoft BitLocker Bypass Attack Method.pdf
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Simplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptxSimplifying Mobile A11y Presentation.pptx
Simplifying Mobile A11y Presentation.pptx
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi Daparthi
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 

Distributed datababase Transaction and concurrency control

  • 1. K.Balamurugan M.Tech-CSE-1st year ADMS Presentation Pondicherry university Distributed Database System - Distributed Transaction
  • 2. Content:  Introduction to Distributed transaction  Distributed Transaction Model  Commit Protocols  Handling Failures  Concurrency control and Recovery in distributed Environments
  • 3. Once again what is distributed database?  A distributed database system consists of loosely coupled sites that share no physical component  Database systems that run on each site are independent of each other  Transactions may access data at one or more sites  Each site has a 1.Transaction Manager 2. transaction coordinator  transaction coordinator -Starting the execution of transactions that originate at the site.  Transaction Manager-Participating in coordinating the concurrent execution of the transactions executing at that site.
  • 4. Transaction System  Access to the various data items in a distributed system is usually accomplished through transactions, which must preserve the ACID properties  The local transactions are those that access and update data in only one local database  The global transactions are those that access and update data in several local databases.
  • 6. Abstract model of a transaction system  Each site has its own local transaction manager, whose function is to ensure the ACID properties of those transactions that execute at that site  The transaction manager manages the execution of those transactions (or sub-transactions) that access data stored in a local site. Note that each such transaction may be either a local transaction (that is, a transaction that executes at (only that site) or part of a global transaction  The transaction coordinator coordinates the execution of the various transactions (both local and global) initiated at that site.
  • 7. Abstract model of a transaction system  Each transaction manager is responsible for Maintaining a log for recovery purposes  the coordinator is responsible for • Starting the execution of the transaction • Breaking the transaction into a number of sub transactions and distributing these sub transactions to the appropriate sites for execution • Coordinating the termination of the transaction, which may result in the transaction being committed at all sites or aborted at all sites
  • 8. System Failure Modes  A distributed system may suffer from the same types of failure that a centralized system does (for example, software errors, hardware errors, or disk crashes)  distributed environment have following unique failures. They are : • Failure of a site • Loss of messages • Failure of a communication link • Network partition
  • 9. Commit Protocols  To ensure atomicity property, the transaction coordinator of T must execute a commit protocol.  There are 2 types of commit protocols:  two-phase commit protocol (2PC) three-phase commit protocol (3PC)
  • 10. Two-Phase Commit protocol  Normal operation, then describe how it handles failures and finally how it carries out recovery and concurrency control.  Let T be a transaction initiated at site Si, and let the transaction coordinator at Si be Ci  Phase 1: Obtaining a Decision  Coordinator asks all participants to prepare to commit transaction Ti .  Ci adds the records <prepare T > to the log and forces log to stable storage  sends prepare T messages to all sites at which T executed  Upon receiving message, transaction manager at site determines if it can commit the transaction  if not, add a record <no T > to the log and send abort T message to Ci  if the transaction can be committed, then:  add the record <ready T > to the log  force all records for T to stable storage
  • 11. Phase 2: Recording the Decision  T can be committed of Ci received a ready T message from all the participating sites: otherwise T must be aborted.  Coordinator adds a decision record, <commit T > or <abort T >, to the log and forces record onto stable storage. Once the record stable storage it is irrevocable (even if failures occur)  Coordinator sends a message to each participant informing it of the decision (commit or abort)  Participants take appropriate action locally.
  • 12. Handling of Failures - Site Failure When site Si recovers, it examines its log to determine the fate of transactions active at the time of the failure.  Log contain <commit T> record: site executes redo (T)  Log contains <abort T> record: site executes undo (T)  Log contains <ready T> record: site must consult Ci to determine the fate of T.  If T committed, redo (T)  If T aborted, undo (T)  The log contains no control records concerning T  implies that Sk failed before responding to the prepare T message from Ci  Sk must execute undo (T)
  • 13. Handling of Failures- Coordinator Failure  If coordinator fails while the commit protocol for T is executing then participating sites must decide on T ’s fate: • If an active site contains a <commit T > record in its log, then T must be committed. • If an active site contains an <abort T > record in its log, then T must be aborted. • If some active participating site does not contain a <ready T > record in its log, then the failed coordinator Ci cannot have decided to commit T . • Can therefore abort T . • If none of the above cases holds, then all active sites must have a <ready T > record in their logs, but no additional control records (such as <abort T > of <commit T >). • In this case active sites must wait for Ci to recover, to find decision.  Blocking problem : active sites may have to wait for failed coordinator to recover.
  • 14. Recovery and Concurrency Control  In-doubt transactions have a <ready T>, but neither a <commit T>, nor an <abort T> log record.  The recovering site must determine the commit- abort status of such transactions by contacting other sites; this can slow and potentially block recovery.  Recovery algorithms can note lock information in the log.  Instead of <ready T>, write out <ready T, L> L = list of locks held by T when the log is written (read locks can be omitted).  For every in-doubt transaction T, all the locks noted in the <ready T, L> log record are reacquired.  After lock reacquisition, transaction processing can resume; the commit or rollback of in-doubt transactions is performed concurrently with the
  • 15. Three-Phase Commit  The three-phase commit (3PC) protocol is an extension of the two-phase commit protocol that avoids the blocking problem.  protocol avoids blocking by introducing an extra third phase where multiple sites are involved in the decision to commit.  coordinator first ensures that at least k other sites know that it intended to commit the transaction. If the coordinator fails, the remaining sites first select a new coordinator.  The new coordinator restarts the third phase of the protocol if some site knew that the old coordinator intended to commit the transaction. Otherwise the new coordinator aborts the transaction.
  • 16. Concurrency Control in Distributed Databases  commit protocol to ensure global transaction atomicity.  The protocols we describe in this section require updates to be done on all replicas of a data item. If any site containing a replica of a data item has failed, updates to the data item cannot be processed.  In this we describe protocols that can continue transaction processing even if some sites or links have failed, thereby providing high availability
  • 17. Locking Protocols  The various locking protocols can be used in a distributed environment. The only change that needs to be incorporated is in the way the lock manager deals with replicated data. We present 2 possible schemes: 1. Single Lock-Manager Approach 2. Distributed Lock Manager
  • 18. Single-Lock-Manager Approach  System maintains a single lock manager that resides in a single chosen site, say Si  When a transaction needs to lock a data item, it sends a lock request to Si and lock manager determines whether the lock can be granted immediately  If yes, lock manager sends a message to the site which initiated the request  If no, request is delayed until it can be granted, at which time a message is sent to the initiating site
  • 19. Single-Lock-Manager Approach  The transaction can read the data item from any one of the sites at which a replica of the data item resides.  Writes must be performed on all replicas of a data item  Advantages of scheme:  Simple implementation  Simple deadlock handling  Disadvantages of scheme are:  Bottleneck: lock manager site becomes a bottleneck  Vulnerability: system is vulnerable to lock manager site failure.
  • 20. Distributed Lock Manager  Distributed lock-manager approach, in which the lock- manager function is distributed over several sites.  When a transaction wishes to lock data item Q, which is not replicated and resides at site Si,a message is sent to the lock manager at site Si requesting a lock(in a particular lock mode). If data item Q is locked in an incompatible mode, then the request is delayed until it can be granted.  Once it has determined that the lock request can be granted,the lock manager sends a message back to the initiator indicating that it has granted the lock request.  Advantage: work is distributed and  Disadvantage: deadlock detection is more complicated
  • 21. Distributed Lock Manager  There are several alternative ways of dealing with replication of data items:  Primary copy  Majority protocol  Biased protocol  Primary Copy:  Choose one replica of data item to be the primary copy.  Site containing the replica is called the primary site for that data item  Different data items can have different primary sites  When a transaction needs to lock a data item Q, it requests a lock at the primary site of Q.  Implicitly gets lock on all replicas of the data item  Benefit  Concurrency control for replicated data handled similarly to replicated data - simple implementation.  Drawback  If the primary site of Q fails, Q is inaccessible even though other
  • 22. Majority Protocol  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.
  • 23. 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
  • 24. Timestamp  Timestamp based concurrency-control protocols can be used in distributed systems  Each transaction must be given a unique timestamp  Main problem: how to generate a timestamp in a distributed fashion  Each site generates a unique local timestamp using either a logical counter or the local clock.  Global unique timestamp is obtained by concatenating the unique local timestamp with the unique identifier.
  • 26. Timestamp  A site with a slow clock will assign smaller timestamps  Still logically correct: serializability not affected  But: “disadvantages” transactions  To fix this problem  Define within each site Si a logical clock (LCi ), which generates the unique local timestamp  Require that Si advance its logical clock whenever a request is received from a transaction Ti with timestamp < x,y > and x is greater that the current value of LCi.  In this case, site Si advances its logical clock to the value x + 1.