CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Concurrency Control --- 2 Steve Ko Computer Sciences and Engineering University at Buffalo.

Slides:



Advertisements
Similar presentations
Database Systems (資料庫系統)
Advertisements

CS 542: Topics in Distributed Systems Transactions and Concurrency Control.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Consensus Steve Ko Computer Sciences and Engineering University at Buffalo.
Concurrency Control II
Concurrency Control Enforcing Serializability by Locks
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Transactions Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Replication Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
1 TRANSACTION & CONCURRENCY CONTROL Huỳnh Văn Quốc Phương Thái Thị Thu Thủy
1 Distribuerede systemer og sikkerhed – 18. marts 2002 zFrom Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design zEdition 3, © Addison-Wesley.
Computer Science 425 Distributed Systems Lecture 21 Transaction Processing and Concurrency Control Reading: Sections
Lecture 11: Transactions and Concurrency Control Haibin Zhu, PhD. Assistant Professor Department of Computer Science Nipissing University © 2002.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
Transactions and concurrency control
Transactions and concurrency control
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Mid-Semester Overview Steve Ko Computer Sciences and Engineering University at Buffalo.
08_Transactions_LECTURE2 DBMSs should guarantee ACID properties (Atomicity, Consistency, Isolation, Durability). This is typically done by guaranteeing.
Lecture 16-1 Computer Science 425 Distributed Systems CS 425 / ECE 428 Fall 2013 Indranil Gupta (Indy) October 17, 2013 Lecture 16 Concurrency Control.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Distributed Shared Memory Steve Ko Computer Sciences and Engineering University at Buffalo.
EE324 INTRO. TO DISTRIBUTED SYSTEMS LECTURE 13 TRANSACTIONS.
Distributed Systems CS 425 / CSE 424 / ECE 428 Transactions & Concurrency Control  2010, I. Gupta, K. Nahrtstedt, S. Mitra, N. Vaidya, M. T. Harandi,
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Replication with View Synchronous Group Communication Steve Ko Computer Sciences and Engineering.
Chapter 12 Transactions 12.1 Introduction 12.2 Transactions 12.3Nested Transactions 12.4 Locks.
CSE 486/586 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Wrap-up Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Wrap-up Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
Slides for Chapter 12: Transactions and Concurrency Control From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3,
CSE 486/586 Distributed Systems Consistency --- 3
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Replication Steve Ko Computer Sciences and Engineering University at Buffalo.
TRANSACTION & CONCURRENCY CONTROL 1. CONTENT 2  Transactions & Nested transactions  Methods for concurrency control  Locks  Optimistic concurrency.
EE324 INTRO. TO DISTRIBUTED SYSTEMS LECTURE 13 TRANSACTIONS.
CSE 486/586 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Byzantine Fault Tolerance Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Transactions on Replicated Data Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
Distributed Transactions What is a transaction? (A sequence of server operations that must be carried out atomically ) ACID properties - what are these.
CSE 486/586, Spring 2014 CSE 486/586 Distributed Systems Paxos Steve Ko Computer Sciences and Engineering University at Buffalo.
Distributed Systems Lecture 12 Concurrency and replication control 1.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Consistency Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo.
CSE 486/586 Distributed Systems Consistency --- 2
CSE 486/586 Distributed Systems Mid-Semester Overview
CSE 486/586 Distributed Systems Consistency --- 2
CSE 486/586 Distributed Systems Consistency --- 1
CSE 486/586 Distributed Systems Consistency --- 3
CSE 486/586 Distributed Systems Concurrency Control --- 1
CSE 486/586 Distributed Systems Consistency --- 1
CSE 486/586 Distributed Systems Concurrency Control --- 2
CSE 486/586 Distributed Systems Concurrency Control --- 3
ENFORCING SERIALIZABILITY BY LOCKS
Atomic Commit and Concurrency Control
Slides for Chapter 12: Transactions and Concurrency Control
CSE 486/586 Distributed Systems Concurrency Control --- 2
CSE 486/586 Distributed Systems Wrap-up
CSE 486/586 Distributed Systems Concurrency Control --- 1
CSE 486/586 Distributed Systems Consistency --- 2
CSE 486/586 Distributed Systems Consistency --- 3
CSE 486/586 Distributed Systems Consistency --- 1
CSE 486/586 Distributed Systems Concurrency Control --- 3
CSE 486/586 Distributed Systems Mid-Semester Overview
Presentation transcript:

CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Concurrency Control Steve Ko Computer Sciences and Engineering University at Buffalo

CSE 486/586, Spring 2013 Midterm Review Please check your midterm –Any mistake? –Any re-grading request? Please come down row-by-row Please return your exam after you’re done. 2

CSE 486/586, Spring 2013 CSE 486/586 Administrivia PA3 deadline: 3/29 (Friday) PA2 grading –Will be done sometime next week (we wanted to grade the midterm first.) Tech Talk: Chris Buryta (Streamline Social) on their virtualization tools for social applications –Today at 6pm –Davis 338A Anonymous feedback form still available. Please come talk to me! 3

CSE 486/586, Spring 2013 Recap: Conflicting Operations Two operations are said to be in conflict, if their combined effect depends on the order they are executed, e.g., read-write, write- read, write-write (all on same variables). NOT read-read, not on different variables. 4 Operations of different transactions ConflictReason read NoBecause the effect of a pair ofread operations does not depend on the order in which they are executed readwriteYesBecause the effect of aread and awrite operation depends on the order of their execution write YesBecause the effect of a pair ofwrite operations depends on the order of their execution

CSE 486/586, Spring 2013 Recap: Serial Equivalence An interleaving of the operations of 2 or more transactions is said to be serially equivalent if the combined effect is the same as if these transactions had been performed sequentially (in some order). Transaction T1 Transaction T2 balance = b.getBalance() b.setBalance = (balance*1.1) balance = b.getBalance() b.setBalance(balance*1.1) a.withdraw(balance* 0.1) c.withdraw(balance*0.1) a: b:c: 278 c: a: 242 b: == T1 (complete) followed by T2 (complete)

CSE 486/586, Spring 2013 Recap: Serial Equivalence How to provide serial equivalence with conflicting operations? –Execute all pairs of conflicting operations in the same order for all objects 6

CSE 486/586, Spring 2013 Recap: Serial Equivalence How to provide serial equivalence with conflicting operations? –Execute all pairs of conflicting operations in the same order for all objects Transaction T1 Transaction T2 balance = b.getBalance() b.setBalance = (balance*1.1) balance = b.getBalance() b.setBalance(balance*1.1) a.withdraw(balance* 0.1) c.withdraw(balance*0.1) a: b:c: 278 c: a: 242 b: == T1 (complete) followed by T2 (complete) Pairs of Conflicting Operations

CSE 486/586, Spring 2013 Implementing Transactions Two things we wanted to take care of (from the last lecture) –Performance: interleaving of operations –Failure: intentional (abort()), unintentional (e.g., process failure) Interleaving must satisfy serial equivalence What about failures? –Should be able to rollback as if no transaction has happened. 8

CSE 486/586, Spring 2013 Handling Abort() What can go wrong? 9 TransactionV: a.withdraw(100); b.deposit(100) TransactionW: aBranch.branchTotal() a.withdraw(100); $100 b.deposit(100) $300 total = a.getBalance() $100 total = total+b.getBalance() $400 total = total+c.getBalance()...

CSE 486/586, Spring 2013 Strict Executions of Transactions Transactions should delay both their read and write operations on an object –Until all transactions that previously wrote that object have either committed or aborted How do we implement serial equivalence & strict executions? Many ways One example: optimistic concurrency control: optimistically perform a transaction  if it’s OK to commit then commit  if not, abort and retry –Examples: Dropbox, Google Docs, Wikipedia, Dynamo, etc. We’ll see how to do this with locks 10

CSE 486/586, Spring 2013 Using Exclusive Locks Exclusive Locks Transaction T1 Transaction T2 begin() balance = b.getBalance() begin() balance = b.getBalance() b.setBalance = (balance*1.1) a.withdraw(balance* 0.1) commit() b.setBalance = (balance*1.1) c.withdraw(balance*0.1) commit() 11 Lock B Lock A UnLock B UnLock A Lock C UnLock B UnLock C … WAIT on B Lock B …

CSE 486/586, Spring 2013 How to Acquire/Release Locks Can’t do it naively 12 Transaction T1 Transaction T2 x= a.read() a.write(20) y = b.read() b.write(30) b.write(x) z = a.read() Lock A UnLock A Lock B UnLock B Lock B UnLock B Lock A UnLock A

CSE 486/586, Spring 2013 Using Exclusive Locks Two phase locking –To satisfy serial equivalence –First phase (growing phase): new locks are acquired –Second phase (shrinking phase): locks are only released –A transaction is not allowed to acquire any new lock, once it has released any one lock Strict two phase locking –To handle abort() (failures) –Locks are only released at the end of the transaction, either at commit() or abort() 13

CSE 486/586, Spring 2013 Summary Strict Execution –Delaying both their read and write operations on an object until all transactions that previously wrote that object have either committed or aborted Strict execution with exclusive locks –Strict 2PL 14

CSE 486/586, Spring Acknowledgements These slides contain material developed and copyrighted by Indranil Gupta (UIUC).