From 8dccfbb36fb539a0417303a13bed195b8522a1d7 Mon Sep 17 00:00:00 2001
From: "Peter J. Keleher" <keleher@cs.umd.edu>
Date: Mon, 13 Nov 2023 11:43:26 -0500
Subject: [PATCH] auto

---
 assign8.md | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)
 create mode 100644 assign8.md

diff --git a/assign8.md b/assign8.md
new file mode 100644
index 0000000..bec8c2a
--- /dev/null
+++ b/assign8.md
@@ -0,0 +1,87 @@
+## Assignment 8: Rollback Recovery
+### Due Dec 1, 2023, 11:59PM
+
+You will be implementing rollback recovery in `transactions.py`. More
+specifically, you will be implementing the `restartRecovery()`
+with functionality as described in Section 19.4, most specifically 19.4.2. You will be recovering as if from a
+crash. Implement both the **redo** and **undo phases**, including
+re-execution, *compensating log records*, etc.
+
+Be sure to write back all modified values.
+
+
+### Setup
+
+Download files for Assignment 9 <a href="https://sedna.cs.umd.edu/424/assign/assignment9Dist.tgz?1">here</a>.
+*We do not provide a new Vagrant file as you can use your existing VM's with this project, or just natively on Macs.*
+
+## Log records
+We use the following log records types:
+- `[1, "START"]`: starts transaction 1.
+- `[5, "COMMIT"]`: commit transaction 5.
+- `[4, "ABORT"]`: Abort transaction 4.
+- `[5, "UPDATE", "R", "2", "A", "10", "7"]`: Updates attr "A" from
+original value "10" to new value "7" for
+record with primary_id "2", of relation R.
+- `[4, "CLR", "R", "11", "A", "10"]`: *Compensation log record* written during undo
+when changing attribute "A", id "11" back to "10". 
+- `[-1, "CHECKPOINT", []]`: Written at end of restart recovery to
+document that all prior changes have been committed to
+disk. Checkpoint records written during failure-free operation include
+a list of active transactions. During recovery there will be no active
+transactions.
+
+For fun, and possibly debugging, the following is the format of the
+"relation" files. The file is a sequence of  1200-character
+blocks. The first block contains a list consisting of:
+- the schema, such as ["ID", "A"]. All columns are of type string.
+- number of data blocks
+- data blocks, each of which is a 1200-character string containing a
+nest list of tuples. With the schema above, each tuple contains a
+value for "ID" and another for "A".
+
+## In More Detail
+Your task is implement `restartRecovery()` in `transactions.py`. This function is
+called if the log file indicates an inconsistency (specifically if the
+logfile does not end with an empty CHECKPOINT record). If that's the
+case, then you must analyze the logfile and do a recovery on that. You
+will:
+- implement the *redo* phase of Section 16.4 by rolling forward from the
+  last checkpoint or the beginning of the log:
+  - keep track of active transactions, taking into account any information
+    from the checkpoint
+  - redo any UPDATE and CLR records encountered
+- implement the *undo* phase of Section 16.4 by rolling back from the end
+  of the log:
+  - reverse the effects of any encountered UPDATE records by changing the data
+    in the relation back to the original, and append CLR records
+  - add abort records when encountering the START record for any active transaction
+- push all changes to the relation file (using `BufferPool.writeAllToDisk`).
+- write a checkpoint record to the log at the end.
+
+Note that order in the log is important, we expect the log and relation files
+to match the answers exactly.
+
+#### Testing
+
+You may use `testingRecoveryNo.py <num>` to test your code. This script:
+- copies `recoveryTest<num>_logfile` and `recoveryTest<num>_relation` from
+`recoveryTests-original` to the
+current directory
+- reads them in and calls `restartRecovery()`
+- writes the logfile to "logfile"
+- writes the possibly modified relation back to the same file.
+
+For example, `python3 testingRecoveryNo.py 1` writes back `logfile` and `recoverytest1_relation` to the
+current directory. The original copies of both were copied from
+`./recoveryTests-original`.  You can find correct output files for some of the
+tests in `./recoveryTests-answers`.
+
+You may, **and should**, create your own testfiles. Either modify the test
+script or populate `./recoveryTests-original` with tests 17, 18, etc.
+
+`vis.pl` may help debugging relation files.
+
+
+### Submission
+Submit modified `transactions.py` file to <a href="https://www.gradescope.com/courses/535193/assignments/2852215">Gradescope</a>. 
-- 
GitLab