Skip to content
Snippets Groups Projects
Commit 4f7d3fdc authored by Peter J. Keleher's avatar Peter J. Keleher
Browse files

auto

parent ec89a55f
No related branches found
No related tags found
No related merge requests found
## Project 5: Transactions, CMSC424, Fall 2019 ## Project 5: Transactions, CMSC424, Fall 2019
**v1.01** **v1.03**
**(Due Dec 8, midnight)** **(Due Dec 8, midnight)**
...@@ -48,8 +48,6 @@ relations and tuples). **The code here and elsewhere implicitly assumes that the ...@@ -48,8 +48,6 @@ relations and tuples). **The code here and elsewhere implicitly assumes that the
- `class TransactionState`: This class encapsulates some of the basic functionality of transactions, including some helper functions to create log records, keeping track of - `class TransactionState`: This class encapsulates some of the basic functionality of transactions, including some helper functions to create log records, keeping track of
what locks the transaction currently holds, etc. what locks the transaction currently holds, etc.
### Example logs and relations
In `recoverytests-original/` and `recoverytests-answers/`
#### Development #### Development
...@@ -133,6 +131,73 @@ will also check for the lock messages ("able to get this lock on...", etc.). ...@@ -133,6 +131,73 @@ will also check for the lock messages ("able to get this lock on...", etc.).
Our testing will check both the contents of the database (the final versions of Our testing will check both the contents of the database (the final versions of
the relation file) and the `logfile`. the relation file) and the `logfile`.
Note that `testingRecovery.py` now uses **"relation"** instead of the original "relation1".
Example logs and relations are
in `recoverytests-original/` and `recoverytests-answers/`. Copy them into the
current directory to run, as in:
titan:~/p5> cp recoverytests-original/recoverytest1_logfile logfile
titan:~/p5> cp recoverytests-original/recoverytest1_relation relation
titan:~/p5> cat logfile
[1, "START"]
[2, "START"]
[3, "START"]
[4, "START"]
[5, "START"]
[6, "START"]
[5, "UPDATE", "recoverytest1_relation", "2", "A", "10", "7"]
[5, "UPDATE", "recoverytest1_relation", "21", "A", "10", "13"]
[4, "UPDATE", "recoverytest1_relation", "1", "A", "10", "7"]
[4, "UPDATE", "recoverytest1_relation", "11", "A", "10", "13"]
[6, "UPDATE", "recoverytest1_relation", "3", "A", "10", "7"]
[6, "UPDATE", "recoverytest1_relation", "31", "A", "10", "13"]
[5, "COMMIT"]
[4, "CLR", "recoverytest1_relation", "11", "A", "10"]
[6, "CLR", "recoverytest1_relation", "31", "A", "10"]
[4, "CLR", "recoverytest1_relation", "1", "A", "10"]
[4, "ABORT"]
[6, "CLR", "recoverytest1_relation", "3", "A", "10"]
[6, "ABORT"]
[1, "UPDATE", "recoverytest1_relation", "0", "A", "10", "20"]
[2, "UPDATE", "recoverytest1_relation", "10", "A", "10", "20"]
[3, "UPDATE", "recoverytest1_relation", "20", "A", "10", "20"]
[1, "COMMIT"]
[2, "COMMIT"]
[3, "COMMIT"]
titan:~/p5> python testingRecovery.py
Reading from 'logfile' and 'relation'
Setting the last_tranasction_id to be 6
Starting Restart Recovery.......
titan:~/p5> cat logfile
[1, "START"]
[2, "START"]
[3, "START"]
[4, "START"]
[5, "START"]
[6, "START"]
[5, "UPDATE", "recoverytest1_relation", "2", "A", "10", "7"]
[5, "UPDATE", "recoverytest1_relation", "21", "A", "10", "13"]
[4, "UPDATE", "recoverytest1_relation", "1", "A", "10", "7"]
[4, "UPDATE", "recoverytest1_relation", "11", "A", "10", "13"]
[6, "UPDATE", "recoverytest1_relation", "3", "A", "10", "7"]
[6, "UPDATE", "recoverytest1_relation", "31", "A", "10", "13"]
[5, "COMMIT"]
[4, "CLR", "recoverytest1_relation", "11", "A", "10"]
[6, "CLR", "recoverytest1_relation", "31", "A", "10"]
[4, "CLR", "recoverytest1_relation", "1", "A", "10"]
[4, "ABORT"]
[6, "CLR", "recoverytest1_relation", "3", "A", "10"]
[6, "ABORT"]
[1, "UPDATE", "recoverytest1_relation", "0", "A", "10", "20"]
[2, "UPDATE", "recoverytest1_relation", "10", "A", "10", "20"]
[3, "UPDATE", "recoverytest1_relation", "20", "A", "10", "20"]
[1, "COMMIT"]
[2, "COMMIT"]
[3, "COMMIT"]
[-1, "CHECKPOINT", []]
titan:~/p5>
### Submission ### Submission
......
...@@ -10,8 +10,8 @@ from exampletransactions import * ...@@ -10,8 +10,8 @@ from exampletransactions import *
##################################################################################################### #####################################################################################################
# Initial Setup # Initial Setup
print("Reading from '{}' and '{}\n".format("logfile", "relation1")) print("Reading from '{}' and '{}'\n".format("logfile", "relation"))
bpool = BufferPool() bpool = BufferPool()
r = Relation('relation1') r = Relation('relation')
LogManager.setAndAnalyzeLogFile('logfile') LogManager.setAndAnalyzeLogFile('logfile')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment