程序代写代做代考 database C CS5481 Data Engineering Tutorial 12

CS5481 Data Engineering Tutorial 12
1.
(a) With immediate modification, modified buffer blocks can be written to the disk even if
the transactions that made those modifications have not all committed. Is there any drawback if this is not allowed?
• It may not work with transactions that perform a large number of updates, since the disk buffer may get filled with updated buffer blocks that cannot be evicted to disk and the transactions cannot proceed.
(b) With immediate modification, a transaction is allowed to commit even if it has modified some buffer blocks that have not yet been written to disk. Is there any drawback if this is not allowed?
• The commit of transactions might be slowed down until all its modified blocks have been output to the disk.
• It may incur more output operations because frequently updated buffer blocks are output multiple times, once for each transaction.
2. Suppose we do not log actions taken during transaction rollback using undo operation and the following log records are generated in which a rollback actually happened to T1 between steps 2 and 3 (but there are no log records reflecting the occurrence of the rollback).
1.
2. 3.
4. 5.
(a) When recovering from a system crash, show how actions taken during recovery could result in an incorrect database state.
(b) What would be the correct sequence of logs?
(a) Since the log contains neither nor , T1 would be undone and A
takes the value 1000. The update made by T2, though committed, is lost.
(b) The correct sequence of logs is as follows: 1.
2. 3.
4.
5.
6.
7.
This would make sure that T1 would not get added to the undo‐list in the redo phase.

CS5481 Data Engineering Tutorial 12
3. Consider the following log. Suppose there is a crash after the last log record is written out.
(a) Show all possible values of all data items on disk after the crash but before recovery?
(b) Show the steps in time sequence during recovery.
(a) A = 500 or 400, B = 2000 or 2050, C = 700, 600.
(b) Recovery would happen as follows:
Redo phase:
a. Undo‐List = {T0, T1}
b. Start from the checkpoint entry and perform the redo operation. c. C = 600
d. T1 is removed from the Undo‐list, Undo‐List = {T0} e. T2 is added to the Undo list, Undo‐List = {T0, T2}
f. A = 400
g. B = 2000
Undo phase:
a. Undo‐List = {T0, T2}
b. Scan the log backwards from the end.
c. output the redo‐only record < T2, A, 500 >; A = 500
d. output < T2 abort >; T2 is removed from the Undo list, Undo‐List = {T0} e. output the redo‐only record < T0, B, 2000 >; B = 2000
f. output < T0 abort >; T0 is removed from the Undo list; Undo‐List = { }