Distributed DBMSPage 10-12. 1© 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.

Slides:



Advertisements
Similar presentations
Outline Introduction Background Distributed Database Design
Advertisements

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
CS542: Topics in Distributed Systems Distributed Transactions and Two Phase Commit Protocol.
(c) Oded Shmueli Distributed Recovery, Lecture 7 (BHG, Chap.7)
CS 603 Handling Failure in Commit February 20, 2002.
Distributed databases
1 ICS 214B: Transaction Processing and Distributed Data Management Lecture 12: Three-Phase Commits (3PC) Professor Chen Li.
CIS 720 Concurrency Control. Timestamp-based concurrency control Assign a timestamp ts(T) to each transaction T. Each data item x has two timestamps:
Computer Science Lecture 18, page 1 CS677: Distributed OS Last Class: Fault Tolerance Basic concepts and failure models Failure masking using redundancy.
ICS 421 Spring 2010 Distributed Transactions Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 3/16/20101Lipyeow.
Distributed Transaction Processing Some of the slides have been borrowed from courses taught at Stanford, Berkeley, Washington, and earlier version of.
Termination and Recovery MESSAGES RECEIVED SITE 1SITE 2SITE 3SITE 4 initial state committablenon Round 1(1)CNNN-NNNN Round 2FAILED(1)-CNNN--NNN Round 3FAILED.
OCT Distributed Transaction1 Lecture 13: Distributed Transactions Notes adapted from Tanenbaum’s “Distributed Systems Principles and Paradigms”
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Systems of Distributed Systems Module 2 -Distributed algorithms Teaching unit 3 – Advanced algorithms Ernesto Damiani University of Bozen Lesson 6 – Two.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Computer Science Lecture 17, page 1 CS677: Distributed OS Last Class: Fault Tolerance Basic concepts and failure models Failure masking using redundancy.
Non-blocking Atomic Commitment Aaron Kaminsky Presenting Chapter 6 of Distributed Systems, 2nd edition, 1993, ed. Mullender.
Distributed DBMSPage 5. 1 © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture  Distributed Database.
1 Distributed Databases CS347 Lecture 16 June 6, 2001.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Distributed DBMSPage 5. 1 © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture  Distributed Database.
1 CS 194: Distributed Systems Distributed Commit, Recovery Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering.
CS 603 Three-Phase Commit February 22, Centralized vs. Decentralized Protocols What if we don’t want a coordinator? Decentralized: –Each site broadcasts.
©Silberschatz, Korth and Sudarshan19.1Database System Concepts Distributed Transactions Transaction may access data at several sites. Each site has a local.
1 More on Distributed Coordination. 2 Who’s in charge? Let’s have an Election. Many algorithms require a coordinator. What happens when the coordinator.
Failure and Availibility DS Lecture # 12. Optimistic Replication Let everyone make changes –Only 3 % transactions ever abort Make changes, send updates.
1 ICS 214B: Transaction Processing and Distributed Data Management Distributed Database Systems.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Commit Protocols. CS5204 – Operating Systems2 Fault Tolerance Causes of failure: process failure machine failure network failure Goals : transparent:
Distributed Commit Dr. Yingwu Zhu. Failures in a distributed system Consistency requires agreement among multiple servers – Is transaction X committed?
CS162 Section Lecture 10 Slides based from Lecture and
Distributed Transactions March 15, Transactions What is a Distributed Transaction?  A transaction that involves more than one server  Network.
8. Distributed DBMS Reliability
Distributed Transactions Chapter 13
Distributed Txn Management, 2003Lecture 4 / Distributed Transaction Management – 2003 Jyrki Nummenmaa
Distributed Systems CS Fault Tolerance- Part III Lecture 19, Nov 25, 2013 Mohammad Hammoud 1.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Distributed Transaction Management, Fall 2002Lecture Distributed Commit Protocols Jyrki Nummenmaa
Fault Tolerance CSCI 4780/6780. Distributed Commit Commit – Making an operation permanent Transactions in databases One phase commit does not work !!!
University of Tampere, CS Department Distributed Commit.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 8 Fault.
Commit Algorithms Hamid Al-Hamadi CS 5204 November 17, 2009.
More on Fault Tolerance Chapter 7. Topics Group Communication Virtual Synchrony Atomic Commit Checkpointing, Logging, Recovery.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 8 Fault.
Committed:Effects are installed to the database. Aborted:Does not execute to completion and any partial effects on database are erased. Consistent state:
Fault Tolerance Chapter 7.
Revisiting failure detectors Some of you asked questions about implementing consensus using S - how does it differ from reaching consensus using P. Here.
Introduction to Distributed Databases Yiwei Wu. Introduction A distributed database is a database in which portions of the database are stored on multiple.
Multi-phase Commit Protocols1 Based on slides by Ken Birman, Cornell University.
Fault Tolerance Chapter 7. Goal An important goal in distributed systems design is to construct the system in such a way that it can automatically recover.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Topics in Distributed Databases Database System Implementation CSE 507 Some slides adapted from Navathe et. Al and Silberchatz et. Al.
Chapter 8 – Fault Tolerance Section 8.5 Distributed Commit Heta Desai Dr. Yanqing Zhang Csc Advanced Operating Systems October 14 th, 2015.
Distributed Databases – Advanced Concepts Chapter 25 in Textbook.
More on Fault Tolerance
Outline Introduction Background Distributed DBMS Architecture
Commit Protocols CS60002: Distributed Systems
Outline Introduction Background Distributed DBMS Architecture
Outline Announcements Fault Tolerance.
Outline Introduction Background Distributed DBMS Architecture
Outline Introduction Background Distributed DBMS Architecture
Distributed Transactions
Distributed Databases Recovery
CIS 720 Concurrency Control.
Last Class: Fault Tolerance
Presentation transcript:

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database Design Distributed Query Processing Distributed Transaction Management  Transaction Concepts and Models  Distributed Concurrency Control  Distributed Reliability n Building Distributed Database Systems (RAID) Mobile Database Systems Privacy, Trust, and Authentication Peer to Peer Systems

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Arise due to non-atomicity of log and message send actions Coordinator site fails after writing “begin_commit” log and before sending “prepare” command  treat it as a failure in WAIT state; send “prepare” command Participant site fails after writing “ready” record in log but before “vote-commit” is sent  treat it as failure in READY state  alternatively, can send “vote-commit” upon recovery Participant site fails after writing “abort” record in log but before “vote-abort” is sent  no need to do anything upon recovery 2PC Recovery Protocols –Additional Cases (see book)

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Coordinator site fails after logging its final decision record but before sending its decision to the participants  coordinator treats it as a failure in COMMIT or ABORT state  participants treat it as timeout in the READY state Participant site fails after writing “abort” or “commit” record in log but before acknowledgement is sent  participant treats it as failure in COMMIT or ABORT state  coordinator will handle it by timeout in COMMIT or ABORT state 2PC Recovery Protocols –Additional Case (see book)

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Problem With 2PC Blocking  Ready implies that the participant waits for the coordinator  If coordinator fails, site is blocked until recovery  Blocking reduces availability Independent recovery is not possible However, it is known that:  Independent recovery protocols exist only for single site failures; no independent recovery protocol exists which is resilient to multiple-site failures. So we search for these protocols – 3PC

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez 3PC is non-blocking. A commit protocols is non-blocking iff  it is synchronous within one state transition, and  its state transition diagram contains  no state which is “adjacent” to both a commit and an abort state, and  no non-committable state which is “adjacent” to a commit state Adjacent: possible to go from one stat to another with a single state transition Committable: all sites have voted to commit a transaction  e.g.: COMMIT state Three-Phase Commit

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez State Transitions in 3PC INITIAL WAIT Commit command Prepare Vote-commit Prepare-to-commit Coordinator Vote-abort Global-abort ABORT COMMIT PRE- COMMIT Ready-to-commit Global commit INITIAL READY Prepare Vote-commit Prepared-to-commit Ready-to-commit Prepare Vote-abort Global-abort Ack Participants COMMIT ABORT PRE- COMMIT Global commit Ack

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Communication Structure (see book) C P P P P C P P P P C ready?yes/no pre-commit/ pre-abort? commit/abort Phase 1Phase 2 P P P P C yes/no ack Phase 3

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Formalism for Commit Protocols Finite set of states Messages addressed to the site Messages sent by the site Initial state Abort states Commit states Q Q V Q Q : Q Q

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Formalism for Commit Protocols Properties: Protocols are non-deterministic: Sites make local decisions. Messages can arrive in any order V V

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Global State Definition Global state vector containing the states of the local protocols. Outstanding messages in the network A global state transition occurs whenever a local state transition occurs at a participating site. Exactly one global transition occurs for each local transition.

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Global Sate Graph Global state is inconsistent if its state vector contains both a commit and abort state. q 1 q 2 xact req w 1 q 2 start xact w 1 w 2 yes w 1 a 2 no a 1 w 2 abort c 1 w 2 commit a 1 a 2 c 1 c 2

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Two states are potentially concurrent if there exists a reachable global state that contains both local states. Concurrency set of s is set of all local states that are potentially concurrent with it. C(s) C(w 1 ) = { V 2, a 2, w 2 } The sender set for s, S(s) = {t/t sends message m & m  M} where M be the set of messages that are received by s. t is a local state.

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez States of Various States in the Commit Protocol Global state inconsistent if it contains both  local commit state  local abort state Final state if  All local states are final Terminal state if:  there exists an immediately reachable successor state   deadlock Committable state (local) if:  all sites have voted yes on committing the transaction Otherwise, non-committable

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez An Example when Only a Single Site Remains Operational This site can safely abort the transaction if and only if the concurrency set for its local state does not contain a commit state This site can safely commit only if  Its local state must be “committable”  And the concurrency set for its state must not contain an abort state. A blocking situation arises when  The concurrency set for the local state contains both a commit and an abort state  Or the site is in a “noncommittable” state and the concurrency set for that state contains a commit state  The site can not commit because it can not infer that all sites have voted yes on committing  It can not abort because another site may have committed the transaction before crashing. There observations imply the simple but power result in the next slide

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Fundamental Non-blocking Theorem Definition : protocol is synchronous within one state transition if one site never leads another site by more than one state transition. Theorem Fundamental non-blocking: A protocol is non- blocking iff  There exists no local state s C(s) = A (abort) and C (commit)  And there exists no non-committable state s C(s) = C (commit) Lemma : A protocol that is synchronous within one state transition is non-blocking iff:  No local state is adjacent to both a commit & an abort state  No non-committable state is adjacent to a commit state

Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Three-Phase Commit Protocol Site i (i = 2,3,…n) (slave) cici aiai wiwi qiqi xact i no i xact i yes i … abort i commit i pipi prepare i ack i p1p1 a1a1 q1q1 w1w1 c1c1 ack 2 ack n commit 2 commit n … … … request xact 2 xact 4 … … no 2 | |no n abort 2 abort n … … yes 2 yes n prepare 2 prepare n Site I (co-ordinator)