Homework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please)

Similar documents
Homework 2: Query Processing/Optimization, Transactions/Recovery (due February 16th, 2017, 9:30am, in class hard-copy please)

Transaction Management Overview. Transactions. Concurrency in a DBMS. Chapter 16

CS 5300 module6. Problem #1 (10 Points) a) Consider the three transactions T1, T2, and T3, and the schedules S1 and S2.

Concurrency Control & Recovery

Transaction Management Overview

What are Transactions? Transaction Management: Introduction (Chap. 16) Major Example: the web app. Concurrent Execution. Web app in execution (CS636)

230 Chapter 17. (c) Otherwise, T writes O and WTS(O) is set to TS(T).

Homework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please)

Transaction Management: Introduction (Chap. 16)

Overview. Introduction to Transaction Management ACID. Transactions

CS 370 Concurrency worksheet. T1:R(X); T2:W(Y); T3:R(X); T2:R(X); T2:R(Z); T2:Commit; T3:W(X); T3:Commit; T1:W(Y); Commit

Transaction Management

Transactions. Transaction. Execution of a user program in a DBMS.

Database Applications (15-415)

Concurrency Control & Recovery

Intro to Transactions

Introduction to Data Management. Lecture #26 (Transactions, cont.)

Intro to Transaction Management

TRANSACTION MANAGEMENT

Homework 5: Miscellanea (due April 26 th, 2013, 9:05am, in class hard-copy please)

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

Assignment 6 Solutions

Transaction Management and Concurrency Control. Chapter 16, 17

Overview of Transaction Management

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

Lecture 21. Lecture 21: Concurrency & Locking

Chapter 7 (Cont.) Transaction Management and Concurrency Control

Introduction to Data Management. Lecture #18 (Transactions)

Transaction Management & Concurrency Control. CS 377: Database Systems

Introduction to Data Management CSE 414

CSE 344 MARCH 5 TH TRANSACTIONS

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

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 13 Managing Transactions and Concurrency

CSC 261/461 Database Systems Lecture 24

Queen s University Faculty of Arts and Science School of Computing CISC 432* / 836* Advanced Database Systems

Chapter 22. Transaction Management

Database Management System

Introduction to Data Management. Lecture #24 (Transactions)

Introduction. Storage Failure Recovery Logging Undo Logging Redo Logging ARIES

CSE 444, Winter 2011, Midterm Examination 9 February 2011

COMPSCI/SOFTENG 351 & 751. Strategic Exercise 5 - Solutions. Transaction Processing, Crash Recovery and ER Diagrams. (May )

Project Assignment 2 (due April 6 th, 2015, 4:00pm, in class hard-copy please)

Database Systems. Announcement

Database Applications (15-415)

Transaction Management. Pearson Education Limited 1995, 2005

Page 1. CS194-3/CS16x Introduction to Systems. Lecture 8. Database concurrency control, Serializability, conflict serializability, 2PL and strict 2PL

Homework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please)

Introduction to Data Management CSE 344

CSE 444: Database Internals. Lectures Transactions

CMPT 354: Database System I. Lecture 11. Transaction Management

Introduction to Data Management CSE 344

ACID Properties. Transaction Management: Crash Recovery (Chap. 18), part 1. Motivation. Recovery Manager. Handling the Buffer Pool.

COURSE 1. Database Management Systems

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

Databases - Transactions II. (GF Royle, N Spadaccini ) Databases - Transactions II 1 / 22

Transaction Management: Crash Recovery (Chap. 18), part 1

some sequential execution crash! Recovery Manager replacement MAIN MEMORY policy DISK

ARIES (& Logging) April 2-4, 2018

Introduction to Data Management CSE 344

Database Management Systems CSEP 544. Lecture 9: Transactions and Recovery

Introduction to Data Management CSE 344

Announcements. Transaction. Motivating Example. Motivating Example. Transactions. CSE 444: Database Internals

CMP-3440 Database Systems

CSE 344 MARCH 9 TH TRANSACTIONS

Transaction Management

CSE 444: Database Internals. Lectures 13 Transaction Schedules

Carnegie Mellon University Department of Computer Science /615 - Database Applications C. Faloutsos & A. Pavlo, Fall 2016

CSE 444 Midterm Exam

CSE 344 MARCH 21 ST TRANSACTIONS

Crash Recovery Review: The ACID properties

Project Assignment 2 (due April 6 th, 2016, 4:00pm, in class hard-copy please)

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

Crash Recovery CMPSCI 645. Gerome Miklau. Slide content adapted from Ramakrishnan & Gehrke

Chapter 17: Recovery System

Failure Classification. Chapter 17: Recovery System. Recovery Algorithms. Storage Structure

Introduction to Data Management CSE 344

TRANSACTION PROCESSING PROPERTIES OF A TRANSACTION TRANSACTION PROCESSING PROPERTIES OF A TRANSACTION 4/3/2014

References. Transaction Management. Database Administration and Tuning 2012/2013. Chpt 14 Silberchatz Chpt 16 Raghu

A tomicity: All actions in the Xact happen, or none happen. D urability: If a Xact commits, its effects persist.

Announcements. Motivating Example. Transaction ROLLBACK. Motivating Example. CSE 444: Database Internals. Lab 2 extended until Monday

XI. Transactions CS Computer App in Business: Databases. Lecture Topics

15-415/615 Homework 8, Page 2 of 11 Thu, 4/24/2014, 1:30pm

Homework 6 (by Sivaprasad Sudhir) Solutions Due: Monday Nov 27, 11:59pm

Transaction Processing. Introduction to Databases CompSci 316 Fall 2018

Homework 2: E/R Models and More SQL (due February 17 th, 2016, 4:00pm, in class hard-copy please)

Homework 4: Query Processing, Query Optimization (due March 21 st, 2016, 4:00pm, in class hard-copy please)

Conflict serializability

Transactions. Kathleen Durant PhD Northeastern University CS3200 Lesson 9

Concurrency Control Serializable Schedules and Locking Protocols

Review: The ACID properties. Crash Recovery. Assumptions. Motivation. More on Steal and Force. Handling the Buffer Pool

Goal of Concurrency Control. Concurrency Control. Example. Solution 1. Solution 2. Solution 3

Database Administration and Tuning

UNIT 9 Crash Recovery. Based on: Text: Chapter 18 Skip: Section 18.7 and second half of 18.8

Database Systems CSE 414

Lectures 8 & 9. Lectures 7 & 8: Transactions

Problems Caused by Failures

CS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #17: Transac0ons 1: Intro. to ACID

DB2 Lecture 10 Concurrency Control

Transaction in Distributed Databases

Introduction to Data Management CSE 344

Transcription:

Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Homework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please) Reminders: a. Out of 100 points. Contains 5 pages. b. Rough time-estimates: 4-6 hours. c. Please type your answers. Illegible handwriting may get no points, at the discretion of the grader. Only drawings may be hand-drawn, as long as they are neat and legible. d. There could be more than one correct answer. We shall accept them all. e. Whenever you are making an assumption, please state it clearly. f. Lead TA for this HW: Elaheh Raisi. Q1. Serializability [30 points] Consider the following schedules (S1 and S2). The actions are listed in the order they are scheduled, and prefixed with the transaction name. S1: T1:R(A), T1:W(A), T3:R(A), T3:W(A), T2:R(B), T2:W(B), T3:R(C), T3:W(C), T1:R(C), T1:W(C), T1:R(B), T1:W(B) S2: T1:R(X), T2:R(X), T1:R(Y), T2:R(Y), T3:R(X), T4:R(Y), T1:W(X), T2: W(Y) Q1.1. (15 points) Consider the schedule S1. A. (5 points) Draw the precedence graph for S1. B. (5 points) Is S1 a conflict serializable schedule? If yes, what is the equivalent serial schedule? If no, explain in 1-2 lines. C. (5 points) From the following options, choose which of the anomalies is present in S1 (if any). Explain in 1-2 lines which actions cause that anomaly. a. Dirty read (WR Conflict) b. Unrepeatable read (RW Conflict) c. Lost update (WW Conflict) Q1.2. (15 points) Consider the schedule S2. A. (5 points) Draw the precedence graph for S2. B. (5 points) Is S2 a conflict serializable schedule? If yes, what is the equivalent serial schedule? If no, explain in 1-2 lines. 1

C. (5 points) From the following options, choose which of the anomalies is present in S2 (if any). Explain in 1-2 lines which actions cause that anomaly. a. Dirty read (WR Conflict) b. Unrepeatable read (RW Conflict) c. Lost update (WW Conflict) Note: The anomalies due to interleaved execution of transactions are explained on slide 38-44 of the lecture 16 or page 526-529 of the textbook. The concept of conflict serializable schedules is explained on slide 46-47 of lecture 16 or page 550-551. The precedence graphs are explained on slide 51-52 of the lecture 16 or page 550-551 of the textbook. Q2. Locking Protocols [20 points] Consider the following schedules. The actions are listed in the order they are scheduled, and prefixed with the transaction name. S1: T1:R(X), T1:W(Y), T1:W(Z), T2:W(Z), T2:Commit, T1:Commit S2:T3:W(X), T1:W(Z), T1:W(Y), T1: Commit, T2: R(Z), T2: Commit, T3: W(Y), T3: Commit. S3: T1: R(X), T3:R(U), T3:W(Z), T3: Commit, T2:W(Z), T2:W(X),T2:Commit, T1:R(Z), T1:Commit. Q2.1. (10 points) Consider schedule S1. A. (5 points) Write the schedule S1 in a table format and draw the precedence B. (5 points) Will the actions of S1 be allowed by the following concurrency Q2.2. (10 points) Consider schedule S2. A. (5 points) Write the schedule S2 in a table format and draw the precedence B. (5 points) Will the actions of S2 be allowed by the following concurrency 2

Q2.3. (10 points) Consider schedule S3. A. (5 points) Write the schedule S3 in a table format and draw the precedence B. (5 points) Will the actions of S3 be allowed by the following concurrency Note: By table format we mean the style given in slide 27-29 in lecture 17. 2PL and Strict 2PL protocols are explained on slide 18-33 of the lecture 17 or textbook page 551-552. Lock Management which explains how the lock requests are granted is explained on slide 36-41 of the lecture 17 or on page 553-554 of the textbook. Q3. Deadlock Management [20 points] Consider the following sequence of actions, listed in the order it is submitted to the DBMS (S is a shared lock, X is an exclusive lock): S1: T2:S(A), T1:X(B), T2:S(B), T3:S(C), T3:X(A), T1:X(C) S2: T1:X(A), T2:S(C), T1:S(B), T2:S(B), T3:X(B), T2:X(A) For S1 and S2 as given above, answer the following questions: Q3.1. (5 points) For S1, write whether lock requests of its actions will be granted or blocked by the lock manager. Q3.2. (5 points) Draw the waits-for graphs for S1 and write if the schedule will result in a deadlock condition. If there is no deadlock condition, write the order of completion of the schedule. Explain in 1-2 lines. Q3.3. (5 points) For S2, write whether the lock requests of its actions will be granted or blocked by the lock manager. Q3.4. (5 points) Draw the waits-for graphs for S2 and write if the schedule will result in a deadlock condition. If there is no deadlock condition, write the order of completion of the schedule. Explain in 1-2 lines. Note: The implementation of lock and unlock requests is given in detail on slide 35-40 of lecture 17 or on page 554 of the textbook. The waits-for graphs are explained on slide 43 of lecture 17 or on page 556 of the textbook. 3

Q4. Logging [23 points] Consider following Log table. LSN Log entry prevlsn undonextlsn 00 update: T1 writes Page P2 10 begin checkpoint 20 update: T2 writes Page P1 30 update: T2 writes Page P4 40 end checkpoint 50 update: T1 writes Page P1 60 T2 commit 70 update: T3 writes Page P1 80 update: T1 writes Page P3 90 update: T3 writes Page P5 100 T3 commit 110 update: T4 writes Page P1 120 T1 abort Q4.1. (10 points) Write the appropriate values in the prevlsn and undonextlsn columns. Q4.2. (5 points) Describe the actions taken to rollback transaction T1. Q4.3. (8 points) Show the log after T1 is rolled back, including all the prevlsn and undonextlsn values in the log records. Note: The Log record and CLR are explained in detail on page 582-585 of the textbook and also in Lecture 19. Q5. Crashing now [5 points] Consider the following log. It is the same one as given in Q4 above, but with a CRASH after LSN 120. LSN Log entry prevlsn undonextlsn 00 update: T1 writes Page P2 10 begin checkpoint 20 update: T2 writes Page P1 30 update: T2 writes Page P4 40 end checkpoint 50 update: T1 writes Page P1 60 T2 commit 70 update: T3 writes Page P1 80 update: T1 writes Page P3 90 update: T3 writes Page P5 100 T3 commit 4

110 update: T4 writes Page P1 120 T1 abort The recovery manager now sees this log (of course with the correct prevlsn and undonextlsn values filled in) after the CRASH. Which transactions will be redone and undone? Note: The concept of crash recovery is explained in detail on page 588-592 of the textbook and also in Lecture 18. Q6. Anagrams [2 points] What is as bad as stems yet an anagram for? 5