Hands-on 6: WALComplete the following hands-on assignment. Do the activities described, and submit your solutions using the Gradescope before 11:59p. Intro to wal-sysThis hands-on assignment will give you some experience using a Write Ahead Log (WAL) system. This system corresponds to the WAL scheme described in Section 9.3 of the textbook. You should carefully read that section before attempting this assignment. You can do this hands-on on any computer that has a Python language interpreter, but we will be able to answer your questions more easily if you run this on an Athena workstation. You can download the WAL system from here (if your browser displays the file in a window instead of saving it, use "File -> Save As" to save the file). The downloaded file is a Python script named wal-sys. Before trying to run it, change its permissions to make it executable, for example by typing: chmod +x wal-sys.py The wal-sys script can be run as follows: ./wal-sys.py [-reset] Alternatively, you can run the script as: python ./wal-sys.py [-reset] Wal-sys is a simple WAL system that models a bank's central database, implementing redo logging for error-recovery. Wal-sys creates and uses two files, named LOG and DB, in the current working directory. The LOG file contains the log entries, and the DB file contains all of the installed changes to the database. After you start wal-sys, you can enter commands to manage
recoverable actions and accounts. There are also commands to simulate a system
crash and to print the contents of the LOG and DB files. All the commands
to wal-sys are case sensitive. Since wal-sys uses the standard
input stream, you can use the system in batch mode. To do this, place your
commands in a file ("cmd.in" for example) and redirect the file to
wal-sys's standard input: ./wal-sys.py -reset < cmd.in When using batch mode, make sure that each command is followed by a newline character (including the last one). When you restart wal-sys, it will perform a log-based recovery of the DB file using the LOG file it finds in the current working directory. The -reset option tells wal-sys to discard the contents of any previous DB and LOG files so that it can start with a clean initial state.Commands interpreted by wal-sysThe following commands are used for managing recoverable actions and accounts:
The following commands help us understand the dynamics of the WAL system:
QuestionsNow you're ready for this week's questions. Like before, the questions are in a read-only google doc. Make sure to enter quesitons in the page indicated (please do not erase the question text) and upload them as a PDF to Gradescope. See more detailed instructions at the end of the first week's hands-on. If you are having Gradescope problems, please post a question on Piazza! |