A transaction is a set of operations that should happen atomically. Exactly which operations that may include is up for discussion, but think reads, writes, deletes, and possibly index lookups for now.

Client-Side Transactions

  1. Client reads A, B, C
  2. Client reserves txid
  3. Client writes A, B, C with lien to txid for some time (how long? see below)
  4. Client writes T with (A', B', C') at txid
  5. Client writes A' into A, B' into B, C' into C
  6. Client deletes T

Consequences:

Server-Side Transactions (2PC)

  1. Client sends MT ("minitransaction") to master
  2. Master writes transaction object with list of participants, acquiring a txid
  3. Master sends txid, MT to all participants
  4. Participants lock objects and log MT
  5. Participants send vote to master
  6. If the decision is yes, the master notes it in the transaction object
  7. Master relays decision to participants
  8. Master sends response to client
  9. If the decision is yes, the participants commit. Otherwise, they unlock/roll back.
  10. Participants sends commit acknowledgement to master
  11. Master removes transaction object

If the client crashes after sending the MT:
The application never learns of the decision. The MT will still commit or abort.

If the master crashes before writing the transaction object (step 2):
The client's RPC library will retry.

If the master crashes before removing the transaction object (step 11):
When the master recovers, it must scan its transaction objects. For each transaction object that does not have a decision to commit, the master assumes it aborted. For each transaction that does, the master knows it committed. It picks back up by relaying the decision to participants (step 7). Participants that have no record of the transaction should simply agree to this.