Fundamentals of Database Systems

Similar documents
Introduction Conflict Serializability. Testing for Serializability Applications Scope of Research

CS322: Database Systems Transactions

Introduction to Transaction Management

Chapter 15: Transactions

Transactions. Lecture 8. Transactions. ACID Properties. Transaction Concept. Example of Fund Transfer. Example of Fund Transfer (Cont.

CHAPTER: TRANSACTIONS

BİL 354 Veritabanı Sistemleri. Transaction (Hareket)

) Intel)(TX)memory):) Transac'onal) Synchroniza'on) Extensions)(TSX))) Transac'ons)

Database System Concepts

Transactions. Prepared By: Neeraj Mangla

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Chapter 13: Transactions

Chapter 9: Transactions

Database Management Systems 2010/11

Chapter 14: Transactions

Transactions These slides are a modified version of the slides of the book Database System Concepts (Chapter 15), 5th Ed

Roadmap of This Lecture

ICOM 5016 Database Systems. Chapter 15: Transactions. Transaction Concept. Chapter 15: Transactions. Transactions

RECOVERY CHAPTER 21,23 (6/E) CHAPTER 17,19 (5/E)

Advanced Databases (SE487) Prince Sultan University College of Computer and Information Sciences. Dr. Anis Koubaa. Spring 2014

Chapter 15: Transactions

Database System Concepts

) Intel)(TX)memory):) Transac'onal) Synchroniza'on) Extensions)(TSX))) Transac'ons)

Databases: transaction processing

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

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

Transaction Management. Chapter 14

Transaction Concept. Two main issues to deal with:

Database Recovery. Dr. Bassam Hammo

CS352 Lecture - The Transaction Concept

) Intel)(TX)memory):) Transac'onal) Synchroniza'on) Extensions)(TSX))) Transac'ons)

Weak Levels of Consistency

Transactions. Silberschatz, Korth and Sudarshan


CSIT5300: Advanced Database Systems

Introduction to Transaction Processing Concepts and Theory

Recoverability. Kathleen Durant PhD CS3200

Transactions and Concurrency Control. Dr. Philip Cannata

Database System Concepts

Chapter 14: Recovery System

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 17-1

Recovery System These slides are a modified version of the slides of the book Database System Concepts (Chapter 17), 5th Ed McGraw-Hill by

Advanced Databases. Transactions. Nikolaus Augsten. FB Computerwissenschaften Universität Salzburg

CS122 Lecture 19 Winter Term,

Chapter 17: Recovery System

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

Transaction Processing Concepts and Theory. Truong Tuan Anh CSE-HCMUT

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

) Intel)(TX)memory):) Transac'onal) Synchroniza'on) Extensions)(TSX))) Transac'ons)

DB2 Lecture 10 Concurrency Control

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

CPS352 Lecture - The Transaction Concept

Chapter 16: Recovery System. Chapter 16: Recovery System

Chapter 14: Transactions

Transactions. ACID Properties of Transactions. Atomicity - all or nothing property - Fully performed or not at all

UNIT 5. Failure Classification. Recovery Techniques. UNIT V Crash Recovery

Lecture 20 Transactions

Chapter 20 Introduction to Transaction Processing Concepts and Theory

Overview of Transaction Management

DATABASE DESIGN I - 1DL300

Transaction Concept. Chapter 15: Transactions. Example of Fund Transfer. ACID Properties. Example of Fund Transfer (Cont.)

Database Tuning and Physical Design: Execution of Transactions

DATABASE TECHNOLOGY - 1MB025

Recovery System These slides are a modified version of the slides of the book Database System Concepts (Chapter 17), 5th Ed

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

HKBU: Tutorial 9

Chapter 17: Recovery System

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

UNIT 4 TRANSACTIONS. Objective

AC61/AT61 DATABASE MANAGEMENT SYSTEMS JUNE 2013

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

Comp 5311 Database Management Systems. 14. Timestamp-based Protocols

CSIT5300: Advanced Database Systems

Transactions and Concurrency Control

Transaction Processing. Introduction to Databases CompSci 316 Fall 2018

Silberschatz and Galvin Chapter 18

Intro to DB CHAPTER 15 TRANSACTION MNGMNT

Goal A Distributed Transaction

Transaction Management & Concurrency Control. CS 377: Database Systems

COURSE 1. Database Management Systems

Database Management System

Lecture X: Transactions

Concurrency Control & Recovery

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

Lecture 21 Concurrency Control Part 1

Database Management System Prof. D. Janakiram Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

VSR, CSR, 2PL, TS, TS-Multi

CSE 190D Database System Implementation

UNIT IV TRANSACTION MANAGEMENT

Advances in Data Management Transaction Management A.Poulovassilis

Final Exam CSE232, Spring 97

ECE 650 Systems Programming & Engineering. Spring 2018

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

Database Technology. Topic 11: Database Recovery

Transaction Management Overview

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

Transaction Processing: Basics - Transactions

Databases - Transactions

Module 15: Managing Transactions and Locks

Transaction Management

Transcription:

Fundamentals of Database Systems Assignment: 6 25th Aug, 2015 Instructions 1. This question paper contains 15 questions in 6 pages. Q1: In the log based recovery scheme, which of the following statement is false? A. The database records are modified only after their corresponding log records are written onto the disk B. The database records and their corresponding log records can be updated onto the disk in any order C. Log records are periodically updated onto the disk D. During recovery using a checkpoint, transactions are not allowed to perform update operations Answer: B is false, because log records are always written onto disk before their corresponding database records are written. Q2: Assume a deferred database modification scheme. Consider the following example of redo log for two transactions. 1. (Start, T1); 2. (Write, T1, Q, 100); 3. (Commit, T1); 4. (Start, T2); 5. (Write, T2, P, 55); 6. (Commit, T2); Consider the following two cases: Case-1: The schedule crashes after Step 5 and before Step 6, and the recovery completes successfully. Case-2: The schedule crashes after Step 5 and before Step 6, and the recovery process starts. During recovery process, the schedule crashes after Step 2 and before Step 3. Which of the following actions must be done for the two cases? A. Case-1: T1: Redo, T2: No action; Case-2: T1: Redo, T2: No action B. Case-1: T1: Redo, T2: Redo; Case-2: T1: Redo, T2; No action C. Case-1: T1: Redo, T2: Redo; Case-2: T1; Redo, T2: Redo D. Case-1: T1: Redo, T2: No action; Case-2: T1: No action, T2: No action 1

Answer: In case of deferred database modification, writes are reflected on the database only after commit log has been written. Hence, for consistent state in both cases, T1 must do the redo operation. On the other hand, no action needs to be taken for T2, because the write operation of T2 has not been reflected on the database. During the second recovery, since it is not guaranteed that the first write has gone through or not, T1 needs to write once more. Q3: Assume an immediate database modification scheme. Consider the following log consisting transactions T1, T2, and T3: 1. (Start, T1); 2. (Write, T1, P, 500, 600); 3. (Write, T1, Q, 400, 500); 4. (Commit, T1); 5. (Start, T2); 6. (Write, T2, P, 600, 550); 7. (Write, T2, Q, 500, 450); 8. (Commit, T2); 9. (Start, T3); 10. (Write, T3, P, 550, 600); 11. (Write, T3, Q, 450, 500); 12. (Commit, T3); Which of the following statement is false? A. If the schedule crashes just after Step 3, then Undo(T1) is performed. B. If the schedule crashes just after Step 11, then after complete recovery process the value of P=550 and Q=450 C. If the schedule crashes just after Step 7, then recovery operations are performed according to the order: Redo(T1), Undo(T2) D. If the schedule crashes just after Step 6, then before the recovery process is started, the system can be in inconsistent state with values of P=550, Q=400 Answer: C is false, because for the recovery algorithm, undo operations are done first, and then redo operations. Q4: For the given schedule, which of the following statement(s) is (are) true? S : r 1 (x), w 1 (x), r 2 (x), r 1 (y), w 1 (y), w 2 (x), r 2 (y), c 1, c 2 ; I: S is recoverable. II: If the order of w 1 (x) and w 2 (x) are interchanged, then S will be a non-recoverable schedule. A. Only I B. Only II C. Both I and II D. None of the above Page 2 of 6

Answer: T 2 reads y after T 1 writes it and T 1 commits before T 2 ; thus, S is recoverable. Since T 1 does not read any item after T 2 writes, if T 2 aborts, T 1 will remain intact. Q5: Given the schedule S, which of the following is true? S : r 1 (x), r 3 (y), r 3 (x), w 1 (x), c 1, w 2 (y), r 2 (x), w 3 (y), c 2, c 3 A. S is not recoverable. B. S is recoverable but not cascadeless. C. S is cascadeless but not strict. D. S is strict. Answer: T 2 reads x after the last transaction that writes x, i.e., T 1, has commited. Hence, S is cascadeless. However, since T 2 writes y before T 3, which has most recently written y, has committed, S is not strict. Q6: Consider the following schedule. S : r 1 (x); w 1 (y); r 2 (x); w 2 (y); r 3 (x); w 3 (y); How many schedules of the six actions in S are conflict-equivalent to S? A. 12 B. 15 C. 24 D. 30 Answer: The three writes have to appear in the order shown, so let us start with the sequence w1(y), w2(y), w3(y), and see where the other three actions could fit in. First, r1(x) must appear before w1(y) because we cannot reorder actions of a transaction. Thus, there is only one choice so far: r1(x), w1(y), w2(y), w3(y). Now, r2(x) can appear in any of the points before w2(y), so there are three choices of where to put r2(x). Finally, regardless of where we put r2(x), there are five choices of where to put r3(x) anywhere ahead of w3(y). Thus, there are 3 x 5 = 15 possible schedules. Q7: Given the following two schedules: S 1 : r 1 (x), r 2 (x), w 2 (x), r 3 (x), w 1 (x), w 2 (y), r 3 (y), w 3 (x) S 2 : r 2 (x), r 1 (x), w 1 (x), w 2 (x), w 2 (y), r 3 (x), w 3 (x), r 3 (y) Which of the following statements are true? I: S1 and S2 are view equivalent. II: S1 performs blind write but S2 does not. A. Only I B. Only II C. Both I and II Page 3 of 6

D. None of them Answer: S1 and S2 are view equivalent since they satisfy all the 3 conditions of view equivalence. S1 and S2 both performs blind write, T 2 writes y without reading it in both S1 and S2. Q8: Consider the two schedules: S 1 : r 1 (x), r 2 (x), w 2 (x), r 3 (x), w 1 (x), w 2 (y), r 3 (y), c 2, w 3 (x), c 1, c 3 S 2 : r 2 (x), r 1 (x), w 1 (x), w 2 (x), w 2 (y), r 3 (x), w 3 (x), r 3 (y), c 1, c 3, c 2 Which of the schedules is recoverable? A. Only S1 B. Only S2 C. Both S1 and S2 D. None of them Answer: S2 is non recoverable because T 3 reads x after T 2 writes but T 3 commits before T 2. Q9: Which of the following statements is false? A. The problem of testing view serializability is NP-complete. B. Serializability ensures correctness of a schedule. C. A conflict serializable schedule is always equivalent to one and only one single serial schedule. D. Every cascadeless schedule is recoverable. Answer: For a conflict serializable schedule, the linear ordering of transactions corresponds to topological sorting of the serialization graph. Since there can be multiple such orderings, multiple equivalent serial schedules may exist. Q10: For the schedule S given below, if transaction T 1 aborts after the last operation of schedule S, then which of the following statements will be true? S : r 1 (x), r 2 (z), w 1 (x), r 3 (x), r 2 (y), w 2 (y), w 3 (x), r 3 (y), r 2 (x) A. Only T 3 will be rolled back. B. First T 2 will be rolled back followed by T 3 rollback. C. First T 3 will be rolled back followed by T 2 rollback. D. There will be no cascading rollbacks. Answer: T 3 reads item x after the T 1 writes x. Thus, first T 3 will be rolled back followed by T 2 because later T 2 reads item x after T 2 writes it. Q11: S : r 1 (x), r 2 (z), w 1 (x), r 3 (x), r 2 (y), w 2 (y), w 3 (x), r 3 (y), r 2 (x) For the schedule S given above, two orderings of commit operations are specified. I: c 1, c 3, c 2 II: c 1, c 2, c 3 Which of these ordering ensures recoverabilty of schedule S? Page 4 of 6

A. Only I B. Both I and II C. Only II D. None of these. Answer: Both the orders are incorrect because T 3 reads item y after T 2 writes it and T 2 reads item x after T 3 writes x. Q12: Which of the following statements is false? A. Blind writes appear in every view-serializable schedule that is not conflict serializable. B. In serialization graph, an edge between two nodes exists if and only if the pair of transactions corresponding to the nodes have conflicting operations. C. Every strict schedule is recoverable. D. Every view serializable schedule is recoverable. Answer: Statement D since they are independent. Q13: Consider the following schedule: S : r 1 (y), r 2 (x), r 2 (y), r 3 (y), w 2 (x), w 1 (y), w 3 (x), r 1 (x) Which of the following statements is true about the schedule S? A. S is conflict serializable but not view serializable B. S is neither conflict serializable nor view serializable C. S is both conflict serializable as well as view serializable D. S is view serializable but not conflict serializable Answer: It is conflict equivalent to S 2, S 3, S 1. Q14: Consider the following schedule: S : r 1 (y), r 2 (z), w 1 (y), w 1 (z), r 2 (x), w 2 (x), r 2 (y), w 2 (y), r 1 (x), c 1, c 2 Which of the following is true about S? A. S is cascadeless B. S is not cascadeless, but recoverable C. S is not recoverable, but changing the order of commits to c 2, c 1 makes the schedule recoverable D. S is not recoverable, and changing the order of commits to c 2, c 1 does not make the schedule recoverable Answer: r 2 (y) is after w 1 (y) and r 1 (x) is after w 2 (x), so the schedule remains non-recoverable even after changing the order of commits. Q15: Consider the following schedule: S : r 1 (x), w 1 (x), r 1 (y), c 1, w 2 (x), c 2, r 3 (y), r 3 (x), c 3 Which of the following is true about the schedule S? Page 5 of 6

A. S is not cascadeless but recoverable B. S is not strict but cascadeless C. S is strict but not serial D. S is serial Answer: S is serial since the transactions take place one after another. Page 6 of 6