Lecture-12 Concurrency Control in Distributed Databases

Slides:



Advertisements
Similar presentations
Types of Distributed Database Systems
Advertisements

CS3771 Today: deadlock detection and election algorithms  Previous class Event ordering in distributed systems Various approaches for Mutual Exclusion.
©Silberschatz, Korth and Sudarshan4.1Database System Concepts Lecture-1 Database system,CSE-313, P.B. Dr. M. A. Kashem Associate. Professor. CSE, DUET,
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Lectures 25-26: Distributed Coordination (Ch 18)
Distributed Databases John Ortiz. Lecture 24Distributed Databases2  Distributed Database (DDB) is a collection of interrelated databases interconnected.
Distributed databases
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Chapter 13 (Web): Distributed Databases
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 17 Distributed Coordination Event Ordering Mutual Exclusion Atomicity Concurrency.
Distributed Databases Logical next step in geographically dispersed organisations goal is to provide location transparency starting point = a set of decentralised.
©Silberschatz, Korth and Sudarshan16.1Database System Concepts 3 rd Edition Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols.
Transaction Management and Concurrency Control
©Silberschatz, Korth and Sudarshan3.1Database System Concepts Extended Relational-Algebra-Operations Generalized Projection Outer Join Aggregate Functions.
Distributed Database Management Systems
Overview Distributed vs. decentralized Why distributed databases
José Alferes Versão modificada de Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapters 22: Distributed Databases.
Chapter 18.2: Distributed Coordination Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 18 Distributed Coordination Chapter.
Chapter 18: Distributed Coordination (Chapter 18.1 – 18.5)
©Silberschatz, Korth and Sudarshan19.1Database System Concepts Distributed Transactions Transaction may access data at several sites. Each site has a local.
©Silberschatz, Korth and Sudarshan19.1Database System Concepts Lecture-10 Distributed Database System A distributed database system consists of loosely.
©Silberschatz, Korth and Sudarshan16.1Database System Concepts 3 rd Edition Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols.
©Silberschatz, Korth and Sudarshan18.1Database System Concepts Centralized Systems Run on a single computer system and do not interact with other computer.
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Remote Backup Systems.
Distributed Databases
04/20/2005Yan Huang - CSCI5330 Database Implementation – Distributed Database Systems Distributed Database Systems.
04/18/2005Yan Huang - CSCI5330 Database Implementation – Distributed Database Systems Distributed Database Systems.
DISTRIBUTED DATABASE SYSTEM.  A distributed database system consists of loosely coupled sites that share no physical component  Database systems that.
Distributed Databases By Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING COLLEGE TIRUVANNAMALAI.
©Silberschatz, Korth and Sudarshan19.1Database System Concepts 1 Chapter 19: Distributed Databases Heterogeneous and Homogeneous Databases Distributed.
Session-8 Data Management for Decision Support
Lecture 16- Distributed Databases Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 12 Distributed Database Management Systems.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 12 Distributed Database Management Systems.
Week 5 Lecture Distributed Database Management Systems Samuel ConnSamuel Conn, Asst Professor Suggestions for using the Lecture Slides.
©Silberschatz, Korth and Sudarshan4.1Database System Concepts Database system,CSE-313, P.B. Dr. M. A. Kashem Associate. Professor. CSE, DUET, Gazipur.
Distributed Database Systems Overview
Concurrency Control in Distributed Databases Gul Sabah Arif.
Operating Systems Distributed Coordination. Topics –Event Ordering –Mutual Exclusion –Atomicity –Concurrency Control Topics –Event Ordering –Mutual Exclusion.
A/18-849B/95-811A/19-729A Internet-Scale Sensor Systems: Design and Policy Lecture 7 Part 1. Distributed Databases Part 2. IrisNet Query Processing.
Distributed Databases DBMS Textbook, Chapter 22, Part II.
ASMA AHMAD 28 TH APRIL, 2011 Database Systems Distributed Databases I.
Databases Illuminated
Distributed Databases
Topic Distributed DBMS Database Management Systems Fall 2012 Presented by: Osama Ben Omran.
Distributed Transaction Management. Outline Introduction Concurrency Control Protocols  Locking  Timestamping Deadlock Handling Replication.
1 Transaction System Processes. 2 Data Servers Used in LANs, where there is a very high speed connection between the clients and the server, the client.
Chapter 19 Distributed Databases. 2 Distributed Database System n A distributed DBS consists of loosely coupled sites that share no physical component.
Lecture 8- Concurrency Control Advanced Databases Masood Niazi Torshiz Islamic Azad university- Mashhad Branch
19.1Database System Concepts - 6 th Edition Chapter 19: Distributed Databases Heterogeneous and Homogeneous Databases Distributed Data Storage Distributed.
Introduction to Distributed Databases Yiwei Wu. Introduction A distributed database is a database in which portions of the database are stored on multiple.
Md Rezaul Huda Chowdhury Reza. Concurrency Control Modify concurrency control schemes for use in distributed environment. We assume that each site participates.
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 15 : Concurrency.
©Silberschatz, Korth and Sudarshan18.1Database System Concepts 3 rd Edition 1 Chapter 18: Distributed Databases Distributed Data Storage Network Transparency.
Academic Year 2014 Spring Academic Year 2014 Spring.
CS3771 Today: Distributed Coordination  Previous class: Distributed File Systems Issues: Naming Strategies: Absolute Names, Mount Points (logical connection.
Topics in Distributed Databases Database System Implementation CSE 507 Some slides adapted from Navathe et. Al and Silberchatz et. Al.
Distributed Databases
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 22: Distributed.
Silberschatz and Galvin  Operating System Concepts Module 18: Distributed Coordination Event Ordering Mutual Exclusion Atomicity Concurrency.
Distributed Databases – Advanced Concepts Chapter 25 in Textbook.
Distributed Databases
Lecture 17- Distributed Databases (continued)
Chapter 19: Distributed Databases
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 19: Distributed.
CSIS 7102 Spring 2004 Lecture 6: Distributed databases
Distributed Database Systems
Database System Architectures
CONCURRENCY Concurrency is the tendency for different tasks to happen at the same time in a system ( mostly interacting with each other ) .   Parallel.
Distributed Databases
Presentation transcript:

Lecture-12 Concurrency Control in Distributed Databases Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Modify concurrency control schemes for use in distributed environment. We assume that each site participates in the execution of a commit protocol to ensure global transaction automicity. We assume all replicas of any item are updated Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

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 Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Single-Lock-Manager Approach (Cont.) 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. Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Distributed Lock Manager In this approach, functionality of locking is implemented by lock managers at each site Lock managers control access to local data items But special protocols may be used for replicas Advantage: work is distributed and can be made robust to failures Disadvantage: deadlock detection is more complicated Lock managers cooperate for deadlock detection Several variants of this approach Primary copy Majority protocol Biased protocol Quorum consensus Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

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 Benefit Concurrency control for replicated data handled similarly to unreplicated data - simple implementation. Drawback If the primary site of Q fails, Q is inaccessible even though other sites containing a replica may be accessible. Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Majority Protocol Local lock manager at each site administers lock and unlock requests for data items stored at that site. When a transaction wishes to lock an unreplicated data item Q residing at site Si, a message is sent to Si ‘s lock manager. 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 Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

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 Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Deadlock Handling Consider the following two transactions and history, with item X and transaction T1 at site 1, and item Y and transaction T2 at site 2: T1: write (X) write (Y) T2: write (Y) write (X) X-lock on X write (X) X-lock on Y write (Y) wait for X-lock on X Wait for X-lock on Y Result: deadlock which cannot be detected locally at either site Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Centralized Approach A global wait-for graph is constructed and maintained in a single site; the deadlock-detection coordinator Real graph: Real, but unknown, state of the system. Constructed graph:Approximation generated by the controller during the execution of its algorithm . the global wait-for graph can be constructed when: a new edge is inserted in or removed from one of the local wait-for graphs. a number of changes have occurred in a local wait-for graph. the coordinator needs to invoke cycle-detection. If the coordinator finds a cycle, it selects a victim and notifies all sites. The sites roll back the victim transaction. Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Local and Global Wait-For Graphs Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Availability High availability: time for which system is not fully usable should be extremely low (e.g. 99.99% availability) Failures are more likely in large distributed systems To be robust, a distributed system must Detect failures Reconfigure the system so computation may continue Recovery/reintegration when a site or link is repaired Failure detection: distinguishing link failure from site failure is hard (partial) solution: have multiple links, multiple link failure is likely a site failure Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Reconfiguration Reconfiguration: Abort all transactions that were active at a failed site Making them wait could interfere with other transactions since they may hold locks on other sites However, in case only some replicas of a data item failed, it may be possible to continue transactions that had accessed data at a failed site (more on this later) If replicated data items were at failed site, update system catalog to remove them from the list of replicas. This should be reversed when failed site recovers, but additional care needs to be taken to bring values up to date If a failed site was a central server for some subsystem, an election must be held to determine the new server E.g. name server, concurrency coordinator, global deadlock detector Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Reconfiguration (Cont.) Since network partition may not be distinguishable from site failure, the following situations must be avoided Two or more central servers elected in distinct partitions More than one partition updates a replicated data item Updates must be able to continue even if some sites are down Solution: majority based approach Alternative of “read one write all available” is tantalizing but causes problems Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Site Reintegration When failed site recovers, it must catch up with all updates that it missed while it was down Problem: updates may be happening to items whose replica is stored at the site while the site is recovering Solution 1: halt all updates on system while reintegrating a site Unacceptable disruption Solution 2: lock all replicas of all data items at the site, update to latest version, then release locks Other solutions with better concurrency also available Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Distributed Query Processing For centralized systems, the primary criterion for measuring the cost of a particular strategy is the number of disk accesses. In a distributed system, other issues must be taken into account: The cost of a data transmission over the network. The potential gain in performance from having several sites process parts of the query in parallel. Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Query Transformation Translating algebraic queries on fragments. It must be possible to construct relation r from its fragments Replace relation r by the expression to construct relation r from its fragments Consider the horizontal fragmentation of the account relation into account1 =  branch-name = “Hillside” (account) account2 =  branch-name = “Valleyview” (account) The query  branch-name = “Hillside” (account) becomes  branch-name = “Hillside” (account1  account2) which is optimized into  branch-name = “Hillside” (account1)   branch-name = “Hillside” (account2) Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Simple Join Processing Consider the following relational algebra expression in which the three relations are neither replicated nor fragmented account depositor branch account is stored at site S1 depositor at S2 branch at S3 For a query issued at site SI, the system needs to produce the result at site SI Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Heterogeneous Distributed Databases Many database applications require data from a variety of preexisting databases located in a heterogeneous collection of hardware and software platforms Data models may differ (hierarchical, relational , etc.) Transaction commit protocols may be incompatible Concurrency control may be based on different techniques (locking, time stamping, etc.) System-level details almost certainly are totally incompatible. A multi database system is a software layer on top of existing database systems, which is designed to manipulate information in heterogeneous databases Creates an illusion of logical database integration without any physical database integration Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.

Advantages Preservation of investment in existing hardware system software Applications Local autonomy and administrative control Allows use of special-purpose DBMSs Step towards a unified homogeneous DBMS Full integration into a homogeneous DBMS faces Technical difficulties and cost of conversion Organizational/political difficulties Organizations do not want to give up control on their data Local databases wish to retain a great deal of autonomy Database system ,CSE-313, P.B. Dr. M. A. Kashem Asst. Professor. CSE, DUET, Gazipur.