M.I.T. DEPARTMENT OF EECS

6.033 - Computer System Engineering Handout 21 - April 26, 2001

Assignment 8: April 30 through May 4

For Lecture, Monday, April 30th (Implementing Transactions)

In preparation for today's lecture on transaction systems, please read Chapter 8 sections C and D and Appendix B.

For Recitation, Tuesday, May 1 (System R)

Read "The Recovery Manager of the System R Database Manager," by Gray et al. (reading 23). Chapter 8, Appendix C of the course text provides a helpful guide for understanding System R. For recitation, answer the following question in a one-page paper:

The authors of System R state that they regret using shadow files in addition to logs (i.e. not supporting a "logged/no shadows" mode for databases). Consider removing shadow files from System R and relying entirely on logs for crash recovery. Describe in detail the effects that this change would have on R's checkpointing and recovery procedure. In what ways and with respect to what resources is the new system more efficient? Less efficient? Section 3.8 of the paper may be useful in considering these tradeoffs.

For Lecture, Wednesday, May 2 (Modular Transactions)

In preparation for this lecture, read Chapter 8 sections E and F.

For Recitation, Thursday, May 3 (System R ad nauseam)

The reading assignment today consists of two short papers. Read "Chocolate" by Plauger and "Engineering: History and Failure" by Petroski. Also complete the following hands-on assignment.

This hands-on assignment will give you some experience using a "textbook" transaction system. You can download the source for the system from here (if your broswer displays the file in a window instead of saving it, hold down the shift key when clicking the link). Build it as follows:

athena% add -f gnu
athena% gtar zxvf trans.tgz
athena% cd trans
athena% gmake

Trans is a simple transaction system that models a bank's central database. It implements logging for error-recovery (without shadow files) as presented in the System R paper and the text. Run ./trans and you will be presented with a prompt. Possible commands are (commands are case sensitive):

  • begin [tid] Begin a transaction denoted by the transaction id tid

  • init [tid] [acct. #] [value] Create a new account with the given account number and starting balance. The first argument specifies that this operation is part of transaction tid. All other commands will take a tid as their first argument.

  • write [tid] [account number] [new value] Update the account to the new value

  • commit [tid] Commit the transaction

  • crash crash the transaction system (this is the only way to exit the program)

  • You may also run trans with the "-d" option (athena% ./trans -d) to dump the log

    1. Analyzing a log To get started examine the log below:

    TID 1: INITIALIZE account 1 to 100
    TID 1: WRITE the value 100 to account 1 (value was 100)
    TID 1: COMMIT
    TID 2: INITIALIZE account 2 to 200
    TID 2: WRITE the value 200 to account 2 (value was 200)
    TID 2: COMMIT
    TID 3: WRITE the value 100 to account 2 (value was 200)
    TID 3: WRITE the value 200 to account 1 (value was 100)
    Answer these questions:
  • Which transactions are winners? losers?
  • What are the final balances of account 1 and 2 after recovery?
  • What was the sequence of operations that created this log trying to accomplish?
  • Did the operation succeed?

    2. Using trans Experiment with the trans system. Produce a new series of operations that results in at least one transaction being a "winner" and one a "loser". Turn in both the list of commands you gave trans and the log.

    Note: you may find it convenient to use trans in batch mode. To do this, place your commands in a file ("cmd.in" for example) and redirect the file to trans's standard input:

    athena% ./trans < cmd.in.

    When using batch mode, make sure that each command is followed by a newline character (including the last one).

    Things should be made as simple as possible, but no simpler -- A. Einstein