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

Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database SystemMeghaj Mallick
 
Query processing and optimization (updated)
Query processing and optimization (updated)Query processing and optimization (updated)
Query processing and optimization (updated)Ravinder Kamboj
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization Hafiz faiz
 
Load Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseLoad Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseMd. Shamsur Rahim
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Meghaj Mallick
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlAbDul ThaYyal
 
Transaction slide
Transaction slideTransaction slide
Transaction slideshawon roy
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocolsChethanMp7
 
2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOLKABILESH RAMAR
 
Deadlock management
Deadlock managementDeadlock management
Deadlock managementAhmed kasim
 
Transaction
TransactionTransaction
TransactionAmin Omi
 
Distributed data processing
Distributed data processingDistributed data processing
Distributed data processingAyisha Kowsar
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!Ashish K
 
Concurrency control
Concurrency controlConcurrency control
Concurrency controlvarsha singh
 
Distributed transaction
Distributed transactionDistributed transaction
Distributed transactionMohitKothari26
 

Tendances (20)

Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database System
 
Query processing and optimization (updated)
Query processing and optimization (updated)Query processing and optimization (updated)
Query processing and optimization (updated)
 
Distributed Transaction
Distributed TransactionDistributed Transaction
Distributed Transaction
 
Query Decomposition and data localization
Query Decomposition and data localization Query Decomposition and data localization
Query Decomposition and data localization
 
Load Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed DatabaseLoad Balancing in Parallel and Distributed Database
Load Balancing in Parallel and Distributed Database
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.Concurrency Control in Distributed Database.
Concurrency Control in Distributed Database.
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
 
Chapter18
Chapter18Chapter18
Chapter18
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
 
Transaction slide
Transaction slideTransaction slide
Transaction slide
 
Lock based protocols
Lock based protocolsLock based protocols
Lock based protocols
 
2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL
 
Deadlock management
Deadlock managementDeadlock management
Deadlock management
 
Transaction
TransactionTransaction
Transaction
 
Distributed data processing
Distributed data processingDistributed data processing
Distributed data processing
 
Concurrency control!
Concurrency control!Concurrency control!
Concurrency control!
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Distributed transaction
Distributed transactionDistributed transaction
Distributed transaction
 

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
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems SHATHAN
 
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
 

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
 
Synchronization in distributed systems
Synchronization in distributed systems Synchronization in distributed systems
Synchronization in distributed systems
 
Distributed deadlock
Distributed deadlockDistributed deadlock
Distributed deadlock
 
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
 

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
 
19. Distributed Databases in DBMS
19. Distributed Databases in DBMS19. Distributed Databases in DBMS
19. Distributed Databases in DBMSkoolkampus
 
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
 
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
 
OSCh17
OSCh17OSCh17
OSCh17
 
OS_Ch17
OS_Ch17OS_Ch17
OS_Ch17
 
19. Distributed Databases in DBMS
19. Distributed Databases in DBMS19. Distributed Databases in DBMS
19. Distributed Databases in DBMS
 
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
 
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

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 

Dernier (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 

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.