Attach extra pages as needed. Write your name and ID on any extra page that you attach. Please, write neatly.

Similar documents
Babu Banarasi Das National Institute of Technology and Management

Concurrency Control. Concurrency Control Ensures interleaving of operations amongst concurrent transactions result in serializable schedules

CSE 344 MARCH 9 TH TRANSACTIONS

CSE 444, Winter 2011, Midterm Examination 9 February 2011

Chapter 6 Distributed Concurrency Control

The University of British Columbia Computer Science 304 Practice Final Examination

Concurrency Control! Snapshot isolation" q How to ensure serializability and recoverability? " q Lock-Based Protocols" q Other Protocols"

Transaction Processing: Concurrency Control. Announcements (April 26) Transactions. CPS 216 Advanced Database Systems

Review. Review. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Lecture #21: Concurrency Control (R&G ch.


Transaction Processing: Concurrency Control ACID. Transaction in SQL. CPS 216 Advanced Database Systems. (Implicit beginning of transaction)

Midterm 2: CS186, Spring 2015

CPSC 310: Database Systems / CSPC 603: Database Systems and Applications Final Exam Fall 2005

Topics in Reliable Distributed Systems

Page 1. Goals of Today s Lecture. The ACID properties of Transactions. Transactions

Transactions and Concurrency Control

Transaction Management. Pearson Education Limited 1995, 2005

CMSC 461 Final Exam Study Guide

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

Page 1. Goals of Todayʼs Lecture" Two Key Questions" Goals of Transaction Scheduling"

Page 1. Goals of Today s Lecture" Two Key Questions" Goals of Transaction Scheduling"

Transaction Management Exercises KEY

Introduction to Data Management CSE 344

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #17: Transac0ons 2: 2PL and Deadlocks

CMSC 424 Database design Lecture 22 Concurrency/recovery. Mihai Pop

In This Lecture. Exam revision. Main topics. Exam format. Particular topics. How to revise. Exam format Main topics How to revise

Name :. Roll No. :... Invigilator s Signature : DATABASE MANAGEMENT SYSTEM

CSE 344 MARCH 25 TH ISOLATION

L i (A) = transaction T i acquires lock for element A. U i (A) = transaction T i releases lock for element A

McGill April 2009 Final Examination Database Systems COMP 421

Transaction Processing. Introduction to Databases CompSci 316 Fall 2018

Introduction to Data Management CSE 414

Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design

Database Systems CSE 414

Database Management Systems Written Exam

Transactions. Kathleen Durant PhD Northeastern University CS3200 Lesson 9

Concurrency Control. Transaction Management. Lost Update Problem. Need for Concurrency Control. Concurrency control

Final Exam CSE232, Spring 97

Concurrency control 12/1/17

Solutions to Final Examination

CS322: Database Systems Transactions

CS 186 Databases. and SID:

DB2 Lecture 10 Concurrency Control

Example Examination. Allocated Time: 100 minutes Maximum Points: 250

Concurrency Control Overview. COSC 404 Database System Implementation. Concurrency Control. Lock-Based Protocols. Lock-Based Protocols (2)

transaction - (another def) - the execution of a program that accesses or changes the contents of the database

Database Management Systems

CS 245 Final Exam Winter 2016

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu.

CSE 444: Database Internals. Lectures 13 Transaction Schedules

References. Concurrency Control. Administração e Optimização de Bases de Dados 2012/2013. Helena Galhardas e

UNIT 4 TRANSACTIONS. Objective

CS 564 Final Exam Fall 2015 Answers

Database System Concepts

Unit 10.5 Transaction Processing: Concurrency Zvi M. Kedem 1

CS/B.Tech/CSE/New/SEM-6/CS-601/2013 DATABASE MANAGEMENENT SYSTEM. Time Allotted : 3 Hours Full Marks : 70

Answers to G51DBS exam

Chapter 22. Transaction Management

Schema Normalization. 30 th August Submitted By: Saurabh Singla Rahul Bhatnagar

The transaction. Defining properties of transactions. Failures in complex systems propagate. Concurrency Control, Locking, and Recovery

Introduction. Examination, INF3100, No examination support material is allowed

CSE 344 MARCH 5 TH TRANSACTIONS

2 nd Semester 2009/2010

Isolation levels. Introduction to Database Design 2012, Lecture 14. Rasmus Ejlers Møgelberg. Questions class about one week before exam

Sample Exam for CSE 480 (2016)

Slides Courtesy of R. Ramakrishnan and J. Gehrke 2. v Concurrent execution of queries for improved performance.

Final Exam CSE232, Spring 97, Solutions

Database design and implementation CMPSCI 645. Lectures 18: Transactions and Concurrency

Today s Class. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Formal Properties of Schedules. Conflicting Operations

Q.1 Short Questions Marks 1. New fields can be added to the created table by using command. a) ALTER b) SELECT c) CREATE. D. UPDATE.

Lecture 13 Concurrency Control

Distributed Database Management System UNIT-2. Concurrency Control. Transaction ACID rules. MCA 325, Distributed DBMS And Object Oriented Databases

3. Transaction theory

Intro to Transactions

CHAPTER: TRANSACTIONS

UNIT IV TRANSACTION MANAGEMENT

Database Systems CSE 414

CS348: INTRODUCTION TO DATABASE MANAGEMENT (Winter, 2011) FINAL EXAMINATION

Lecture 21 Concurrency Control Part 1

TRANSACTION PROCESSING CONCEPTS

Solutions to Final Examination

CS 5614: Transaction Processing 121. Transaction = Unit of Work Recall ACID Properties (from Module 1)

Chapter 12 : Concurrency Control

Introduction to Data Management CSE 344

Transaction Management and Concurrency Control. Chapter 16, 17

! A lock is a mechanism to control concurrent access to a data item! Data items can be locked in two modes :

h p:// Authors: Tomáš Skopal, Irena Holubová Lecturer: Mar n Svoboda, mar

Sample Exam for CSE 480 (2017) KEY

UNIT-IV TRANSACTION PROCESSING CONCEPTS

Functional Dependencies CS 1270

Chapter 13 : Concurrency Control

Introduction. Storage Failure Recovery Logging Undo Logging Redo Logging ARIES

DATABASE DESIGN I - 1DL300

CS122 Lecture 15 Winter Term,

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2008 Quiz I

Lecture 22 Concurrency Control Part 2

Chapter 9: Concurrency Control

CSC 261/461 Database Systems Lecture 21 and 22. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

DATABASE MANAGEMENT SYSTEMS

Transcription:

UCLA Computer Science Department Fall 2003 Instructor: C. Zaniolo TA: Fusheng Wang Student Name and ID: CS143 Final EXAM: Closed Book, 3 Hours Attach extra pages as needed. Write your name and ID on any extra page that you attach. Please, write neatly. Problem 1 (24%) 2 (25%) 3 (30%) 4 (21%) Total (100%) Score Extra Credit: Final Score: 1

CS143 Final Exam, Fall 2003 Page: i Problem 1. 24 Points In a distributed DB, there are three sites, A, B, C, and there are communication lines between A and B and between B and C, but no direct line between A and C. The three sites co-operate in a distributed transaction using the Two-Phase Commit (2PC) protocol; A is the coordinator. If you agree with the following statements, just write TRUE. If you disagree, write FALSE and explain the reasons why the statement is false. The communication lines: A B C A. If the communication is lost between A and B, A waits indefinitely in a blocked state till communication is restored. FALSE: A is the coordinator. If the communication stops before it receives the vote to commit by all the sites, the coordinator waits for a while, but then it aborts and instructs the participants to do the same. Once the coordinator receives commit from all participants the coordinator just commit and sent them back the commit order. B. Say that B receives the commit instruction from A but cannot forward such instruction to C since the line between B and C is down. Then B must wait in a blocked state till the line is restored and C can be sent the instruction to commit. FALSE: B commits. In general, the sites act on the basis of the messages they receive, not on the basis of the messages they can send (since they can never be sure on the state of lines). Now say that B receives the commit instruction from A, but immediately after that, both lines between A and B and between B and C go down. Say that the line between B and C is restored well before the line between B and A. Then: C. B remains in a blocked state till the line with A is restored, and then asks A for instructions. FALSE: B commits. Same reason as in the previous case B. D. C remains in a blocked state till its line with B is restored, and then it ask B for its decision and replicates it. TRUE. Since C never received the commit message, it will have to ask B what happened and follow suite.

CS143 Final Exam, Fall 2003 Page: ii Problem 2, 25 points: Consider the following schedule (where T0 is older than T1, which is older than T2). T0 T1 T2 -------------------------------------- write(a) read(b) read(b) write(b) read(a) write(a) request a lock on A and abort read(c) write(c) read(d) --------------------------------------- a) Draw the precedence graph and list all the equivalent serial schedules for the completed transactions. Precedence Graph: T0--A,C--> T1; T2 does not complete, it aborts. The only equivalent serial schedule is T0 followed by T1. b) Which of the following policies could have generated this schedule? (1) A 2PL protocol? (show a complete schedule with the lock-x, lock-s and unlock for each resource) Assume 2PL. At the point where T2 performs write(t2) T0 and T1 must have released the locks they previously had on B. Thus, at this point, T0 and T1 are in the shrinking phase where no new lock can be obtained. Since, at this point, only one has has a lock on C and no new lock can obtained later, they cannot both perform the operations shown in the schedule. Thus, this is not a 2PL protocol. (2) a strict 2PL protocol? (show a complete schedule with the lock-x, lock-s and unlock for each resource) N0: This is not 2PL, and is not strict. The schedule show that T1 locks A before T0 has completed; but in a strict 2PL T0 would have kept the lock till the end of the transaction. (3) 2PL with wait-die deadlock prevention strategy? NO: T0 and T1 do not follow 2PL. However, T2 follows the wait-die strategy: the younger transaction T2 finds B locked by the older T1 and thus abort and restarts later with its old timestamp. (4) 2PL with a wound-wait deadlock prevention strategy? NO: T0 and T1 do not follow 2PL, and no with wound-wait the younger T2 would have waited until A is unlocked by the older T1. (5) Cascading of rollbacks to kill transactions that performed dirty reads NO. A dirty read is on piece of data changed by a different transaction that has then aborted. Here T2 aborts, but nobody reads the data written by T2.

CS143 Final Exam, Fall 2003 Page: iii We have a relation schema R(C, S, J, D, P, Q, V ) with the fol- Problem 3, 30 points: lowing FDs: C CSJDP QV JP C SD P J S a) Find a canonical cover for these FDs (show the steps) 1. JP C 2. SD P 3. J S 4. C S 5. C J 6. C D 7. C P 8. C Q 9. C V No extraneous attribute in the left side of the first two FDs. However, FDs 4. and 7. are redundant. b) Use the 3NF design algorithm to design a 3NF schema that has the lossless-join property and a minimal relation count (show the steps) R 1 (J, P, C); R 2 (S, D, P); R 3 (J, S); R 4 (C, J); R 5 (C, D); R 6 (C, Q); R 7 (C, V). Lossless join property: C is a key for the original relation and the 3NF decomposition. No additional relation needed to ensure the lossless join property. Minimal relation count: all the relations with candidate key C can be merged. Also C JP : thus the first relation can be joined with those having C as Key. We obtain: R 14567 (J, P, C, D, Q, V); R 2 (S, D, P); R 3 (J, S). c) Is the resulting schema BCNF (explain your answer)? Yes. FD 3 is no longer contained in any relations. All the remaining FDs are in relations where their left side is a superkey (an actual key for all the FDs at hand).

CS143 Final Exam, Fall 2003 Page: iv Problem 4, 21 points: Course(CName, Level, D#), Dept(D#, Chair, School), Class(CName, Section, Year, Quarter, Enrollment) a) Draw the E-R diagram from which this 3NF schema could have been produced. Section Year Quarter Enrollment CName Level D# Chair School Class Section Course Offers Dept b) Now assume that currently there are 20 schools, 100 departments, 4000 different courses, and two sections for each course. Every school offers some courses. Indicate what primary and secondary indices should be created to support the following two queries efficiently: Q1: Find the chair of the department offering a given course, Index Course.Cname to find D# for the given course. Then to find the chair of the department D# just found we can use an index Dept.D#. Each search finds one record, at most. There is no benefit in clustering the file by the key of an index supporting exact-match searches for a single record. Q2: Finds all courses offered in a given school. To support the search for the given School, we should have an index on Dept.School; then, using D# so found we should have. index on Course.D# to expedite the join. On the average, there are five departments per each school, and 40 courses per department. Thus, both searches are greatly expedited by clustering these two indexes i.e., we should make both of them primary indexes. c) Estimate the average number of tuples produced by Q2. Say that D# is a key foreign key. Then the natural join of Course and School contains 4000 different tuples. Also there are 20 different schools in the join. Then Q2 returns 4000/20=200. Otherwise, we can assume 5 departments per school and 40 courses per department. Then Q2 returns 5 40 = 200 tuples.

CS143 Final Exam, Fall 2003 Page: v Extra Credit Problem, 4 points: On the average, should you expect fewer rollbacks with the wait-die protocol or the wound-wait protocol? (Justify your answer) In the wait-die, when the younger transaction dies and is restarted immediately it is likely to find the same resource still occupied. Then it will die again, and this situation could occur several times. For wound-wait, the younger transaction (Y) can be killed by an older transaction (O). When restarted, Y is likely to find the resource still occupied by the its killer O: but now, Y is the younger of the two and waits, and it gets the resource as soon as O is done.