Database Management Assignment Help
Database Management Assignment Help
Transaction 1 Transaction 2
READ A READ A
READ B WRITE B
WRITE C WRITE C
Interleaving 1: Interleaving 2:
Interleaving 1:
1 T1: READ A
2 T2: READ A
3 T1: READ A
4 T1: WRITE B
5 T2: COMMIT
6 T1: WRITE A
7 T2: COMMIT
8 T1: WRITE A
9 T1: COMMIT
Transaction 1 Transaction 2
WRITE A WRITE B
READ B READ C
Interleaving 4: Interleaving 4:
(b) Show all of the records that should be in the log at the time of the
crash (given your serial order), assuming that there have been no
checkpoints and that you are using an ARIESstyle logging and
recovery protocol. Your records should include all of the relevant
fields described in Section 4.1 of the ARIES paper. Also show the
status of the transaction table (as described in Section 4.3 of the
ARIES paper) after the analysis phase of recovery has run. Given the
above interleaving, the log contains:
If you don’t want to assume that the entire database will fit into
nonvolatile memory, then another good approach is to store just
the buffer pool and recovery data structures (e.g., dirty page
table and transaction table) in nonvolatile. Then, when the
system recovers from a crash, the buffer pool and recovery
structures will be intact. This will eliminate the need for a
REDO phase, without requiring us to FORCE writes to disk.
We do need to be a little bit careful because it’s possible that
the system was in the middle of a write to disk when the crash
occurred, causing data on disk to be nonaction consistent. To
correct this, we can keep an extra bit with each page in the dirty
page table that indicates we are in the process of writing the
page to disk. We set this bit just before writing the page, and
unset it after writing completes. If the bit is set at recovery
time, we must write the page out again. This ensures page
flushes are atomic.
Note that, in this scheme, we will still have to UNDO
transactions that were running at the time the system crashed
by removing their effects from both the buffer pool and disk.
We can further increase the performance of this scheme by
keeping the log, which consists only of UNDO records, in
nonvolatile memory. Since we can delete the log records of a
transaction after it commits (since we will never need to
REDO), this log only contains records for the running
transactions, and thus will be quite compact. Note that the
Postgres Storage Manager proposes to use nonvolatile memory
in very much this way.