IM NTU Distributed Information Systems 2004 Distributed Transactions -- 1 Distributed Transactions Yih-Kuen Tsay Dept. of Information Management National.

Slides:



Advertisements
Similar presentations
Distributed Systems Course Distributed transactions
Advertisements

TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
CS542: Topics in Distributed Systems Distributed Transactions and Two Phase Commit Protocol.
Slides for Chapter 13: Distributed transactions
COS 461 Fall 1997 Transaction Processing u normal systems lose their state when they crash u many applications need better behavior u today’s topic: how.
Database Systems, 8 th Edition Concurrency Control with Time Stamping Methods Assigns global unique time stamp to each transaction Produces explicit.
Exercises for Chapter 17: Distributed Transactions
CIS 720 Concurrency Control. Timestamp-based concurrency control Assign a timestamp ts(T) to each transaction T. Each data item x has two timestamps:
1 TRANSACTION & CONCURRENCY CONTROL Huỳnh Văn Quốc Phương Thái Thị Thu Thủy
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
ICS 421 Spring 2010 Distributed Transactions Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 3/16/20101Lipyeow.
Distributed Systems 2006 Styles of Client/Server Computing.
Distributed Systems Fall 2010 Transactions and concurrency control.
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
Quick Review of May 1 material Concurrent Execution and Serializability –inconsistent concurrent schedules –transaction conflicts serializable == conflict.
Transaction Management and Concurrency Control
Persistent State Service 1 Distributed Object Transactions  Transaction principles  Concurrency control  The two-phase commit protocol  Services for.
Chapter 8 : Transaction Management. u Function and importance of transactions. u Properties of transactions. u Concurrency Control – Meaning of serializability.
1 Transaction Management Database recovery Concurrency control.
Chapter 18: Distributed Coordination (Chapter 18.1 – 18.5)
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 11: Transactions Dr. Michael R. Lyu Computer Science & Engineering.
CMPT 401 Summer 2007 Dr. Alexandra Fedorova Lecture XI: Distributed Transactions.
CMPT Dr. Alexandra Fedorova Lecture XI: Distributed Transactions.
Distributed Systems Fall 2009 Distributed transactions.
TRANSACTION PROCESSING TECHNIQUES BY SON NGUYEN VIJAY RAO.
CMPT Dr. Alexandra Fedorova Lecture XI: Distributed Transactions.
Transactions and concurrency control
Distributed Deadlocks and Transaction Recovery.
Distributed Transactions March 15, Transactions What is a Distributed Transaction?  A transaction that involves more than one server  Network.
DISTRIBUTED SYSTEMS II AGREEMENT (2-3 PHASE COM.) Prof Philippas Tsigas Distributed Computing and Systems Research Group.
Distributed Transactions: Distributed deadlocks Recovery techniques.
Transaction Communications Yi Sun. Outline Transaction ACID Property Distributed transaction Two phase commit protocol Nested transaction.
Lecture 12: Distributed transactions Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
Distributed Transactions
CSE 486/586 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Transactions CS425 /CSE424/ECE428 – Distributed Systems – Fall 2011 Nikita Borisov - UIUC Material derived from slides by I. Gupta, M. Harandi,
Operating Systems Distributed Coordination. Topics –Event Ordering –Mutual Exclusion –Atomicity –Concurrency Control Topics –Event Ordering –Mutual Exclusion.
Transactions and Concurrency Control Distribuerade Informationssystem, 1DT060, HT 2013 Adapted from, Copyright, Frederik Hermans.
IM NTU Distributed Information Systems 2004 Replication Management -- 1 Replication Management Yih-Kuen Tsay Dept. of Information Management National Taiwan.
 Distributed file systems having transaction facility need to support distributed transaction service.  A distributed transaction service is an extension.
Distributed Transactions Chapter – Vidya Satyanarayanan.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 17: Distributed.
 2002 M. T. Harandi and J. Hou (modified: I. Gupta) Distributed Transactions.
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.
A client transaction becomes distributed if it invokes operations in several different Servers There are two different ways that distributed transactions.
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
10-Jun-16COMP28112 Lecture 131 Distributed Transactions.
Atomic Tranactions. Sunmeet Sethi. Index  Meaning of Atomic transaction.  Transaction model Types of storage. Transaction primitives. Properties of.
Distributed Databases – Advanced Concepts Chapter 25 in Textbook.
Recovery in Distributed Systems:
Two phase commit.
Outline Announcements Fault Tolerance.
Replication and Recovery in Distributed Systems
CSE 486/586 Distributed Systems Concurrency Control --- 3
Slides for Chapter 14: Distributed transactions
Distributed Transactions
Atomic Commit and Concurrency Control
Distributed Transactions
Exercises for Chapter 14: Distributed Transactions
Distributed Transactions
UNIVERSITAS GUNADARMA
Transactions in Distributed Systems
Distributed Transactions
Distributed Systems Course Distributed transactions
Distributed Transactions
TRANSACTION & CONCURRENCY CONTROL
CIS 720 Concurrency Control.
CSE 486/586 Distributed Systems Concurrency Control --- 3
Presentation transcript:

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 1 Distributed Transactions Yih-Kuen Tsay Dept. of Information Management National Taiwan University

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 2 Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Structures of Distributed Transactions

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 3 Both types of transaction invoke operations in more than one server. A flat transaction accesses servers’ objects sequentially. The subtransactions of a nested transaction can run in parallel (concurrently). Flat vs. Nested Transactions

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 4 Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. * The four subtransactions can run in parallel. A Nested Banking Transaction

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 5 Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. * A transaction identifier may include the server identifier and a serial number. A Distributed Banking Transaction

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 6 Atomic Commitment in Flat Transactions When a distributed flat transaction comes to an end, either all or none of its operations (in different servers) are carried out. If one part of a transaction for some reasons (e.g., server crash, failure of validation) has to abort, then the whole transaction must also be aborted.

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 7 The Two-Phase Commit Protocol A participant (server) is allowed to abort its part of a transaction (even after performing all operations). In the first phase, each server votes for the transaction to be committed or aborted. In the second phase, every server carries out the joint decision. The protocol tolerates server crashes or message losses.

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 8 Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. * A participant is prepared to commit when it has recorded the changes and its status in permanent storage. The Two-Phase Commit Protocol (cont.)

IM NTU Distributed Information Systems 2004 Distributed Transactions -- 9 Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. The Two-Phase Commit Protocol (cont.)

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. The Two-Phase Commit Protocol (cont.)

IM NTU Distributed Information Systems 2004 Distributed Transactions Atomic Commitment in Nested Transactions When a subtransaction completes, it makes an independent decision either to commit provisionally or to abort. A parent transaction may commit even if one of its child transactions has aborted. If a parent transaction aborts, then its subtransactions will be forced to abort. Subtransactions will not carry out a real commitment unless the entire nested transaction descides to commit.

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. * A provisional commit is not backed up in permanent storage. Deciding Whether to Commit

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Operations in Coordinator for Nest Transactions

IM NTU Distributed Information Systems 2004 Distributed Transactions Two-Phase Commit in Nested Transactions When a subtransaction provisionally commits, it reports its status and the status of its descendants to its parent. When a subtransaction aborts, it just reports abort to its parent. Eventually, the top-level transaction receives a list of all subtransactions (except the descendants of an aborted transaction) in the tree, together with the status of each.

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Two-Phase Commit in Nest Transactions (cont.)

IM NTU Distributed Information Systems 2004 Distributed Transactions (Flat) Two-Phase Commit Protocol The top-level coordinator sends canCommit? to all sub-coordinators in the provisional commit list. When a server receives a canCommit?... –If it has provisionally committed substractions prepares those without aborted ancestors for commitment, aborts those with aborted ancestors, and sends a Yes vote to the coordinator. –Otherwise (it must have failed), sends a No vote.

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. The canCommit? Operation for Two-Phase Commit in Nested Transactions

IM NTU Distributed Information Systems 2004 Distributed Transactions Concurrency Control in Distributed Transactions Each server applies concurrency control to its own objects. Every pair of transactions are serializable in the same order at all servers.

IM NTU Distributed Information Systems 2004 Distributed Transactions Locking Each server maintains locks for its own objects. Locks cannot be released until the transaction has been committed or aborted at all servers. Distributed deadlocks might occur if different servers impose different orderings on transactions.

IM NTU Distributed Information Systems 2004 Distributed Transactions Timestamp Ordering A globally unique transaction timestamp is issued by the top-level coordinator. All servers must agree on how the timestamps are ordered. Conflicts are resolved as each operation is performed.

IM NTU Distributed Information Systems 2004 Distributed Transactions Optimistic Concurrency Control If only one transaction may perform validation at the same time, commitment deadlocks might occur. Transaction TTransaction U Read(A) at X Write(A) Read(B) at Y Write(B) Read(B) at Y Write(B) Read(A) at X Write(A)

IM NTU Distributed Information Systems 2004 Distributed Transactions Optimistic Concurrency Control (cont.) Parallel validation prevents commitment deadlocks. A parallel validation checks (among other things) conflicts between write operations of the transaction being validated against the write operations of other concurrent transactions.

IM NTU Distributed Information Systems 2004 Distributed Transactions Optimistic Concurrency Control (cont.) To ensure that transactions at different servers are globally serializable, the servers may –conduct a global validation (checking if there is a cyclic ordering) or –use the same globally unique transaction number for the same transaction.

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. An Interleaving of Three Transactions

IM NTU Distributed Information Systems 2004 Distributed Transactions Distributed Deadlocks A cycle in the global wait-for graph (but not in any single local one) represents a distributed deadlock. A deadlock that is detected but is not really a deadlock is called a phantom deadlock. Two-phase locking prevents phantom deadlocks; autonomous aborts may cause phantom deadlocks.

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Distributed Deadlocks and Wait-For Graphs

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Local and Global Wait-For Graphs

IM NTU Distributed Information Systems 2004 Distributed Transactions Edge Chasing Initiation: when a server notes that a transaction T starts waiting for another transaction U, which is waiting to access an object at another server, it sends a probe containing  T  U  to the server of the object at which transaction U is blocked.

IM NTU Distributed Information Systems 2004 Distributed Transactions Edge Chasing (cont.) Detection: receive probes and decide whether deadlock has occurred and whether to forward the probes. When a server receives a probe  T  U  and finds the transaction that U is waiting for, say V, is waiting for another object elsewhere, a probe  T  U  V  is forwarded. Resolution: select a transaction in the cycle to abort

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Probes for Detecting Deadlocks

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Independently Initiated Probes

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Probes Traveling Downhill

IM NTU Distributed Information Systems 2004 Distributed Transactions Transaction Recovery Requirements: durability and failure atomicity Specific goal: restore the server with the latest committed versions of its objects. Tasks of the recovery manager: –Save objects in permanent storage (a recovery file) –Restore objects after a crash –Reorganize the recovery file and reclaim storage –Optional: be resilient to media failures

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Types of Entry in a Recovery File

IM NTU Distributed Information Systems 2004 Distributed Transactions Two Approaches to the Use of Recovery Files Logging –Basic ideas: history of transactions, snapshots, … –Recovery of objects: forward or backward –Checkpointing Shadow versions –Basic ideas: map, shadow version, version store, … –Switching from the old map to the new map –Checkpointing

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Log for Banking Service

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Shadow Versions

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. A Log for the Two-Phase Commit Protocol

IM NTU Distributed Information Systems 2004 Distributed Transactions Source: G. Coulouris et al., Distributed Systems: Concepts and Design, Third Edition. Recovery of the Two-Phase Commit Protocol