CS505 : Distributed Systems

Programming Assignment 4: 3 Phase Commit

Note: Questions are fully expected on this programming assignment. Do not hesitate to post and ask both the professor and TA. Some instruction is below, but it will doubtlessly be insufficient as a comprehensive guide. (complete, but may be updated)

Background/Protocol

The aim of this programming assignment is to understand and implement the complete state machine of Three Phase Commit. It involves building a distributed system from a (somewhat) complex state diagram (design), and handle all failure scenarios that the protocol supports. A description of the protocol that is suitable for implementation can be found here. Your task is to implement this state machine in Mace.

For this project, you may use cloud11.cs.purdue.edu through cloud15.cs.purdue.edu. The necessary tools for building and running Mace and the model checker should all be available on those machines.

You should be able to build on your earlier Mace checkout. However, in general: you should use cmake to build Mace out-of-source, and within your scratch directory on these machines. (Mace, when compiled, is quite large, and so keeping the build on /scratch will keep your directory from causing you grief from the sysadmins)

You are welcome to do this project on any machine on which you can build Mace, which should be generally true of Linux and OSX systems. We will use a departmental gentoo build for testing them.

For this project, you only need to submit your final HW4Commit3PC.mac.

We will be implementing the CommitServiceClass which is created for this assignment. You can assume a static Group Membership, which is supplied as argument to the joinGroup downcall. (This part of the code is already complete). I have removed code from my working implementation for you to fill in. You would need to add state variables, define messages and handle their delivery. The static group membership is already handled.

You are required to handle a single round of the protocol. Each member (including the coordinator) initiates the protocol using startCommit and expects the protocol to call back with upcalls either Commit or Abort. All members should either commit or all have to abort. The coordinator is picked as the node with the least identifier.

The protocol you should implement is as follows:

More details on how to react to node failures and recovery from failures are handled based on the protocol. This is also provided in the web link provided.

Environment/Development

To get started on the homework, you should setup your environment as follows:

When editing Mace files (.mac), it is helpful in most editors to use the syntax highlighting for C++. If you are a Vim user, there is a vim syntax file you can use. If you wish to contribute syntax files for other editors, I am happy to share them with others.

Model checking / Debugging

To run and debug this project, we will be using the Mace modelchecker. To setup your environment for model checking:

Useful hints:

Submission and Grading:

Submit only the file HW4Commit3PC.mac, using BlackBoard. You can find the submission section in the "Assignments" section of BlackBoard for the class. Submissions will be graded according to this grading rubric (TXT).