This project has two components. First, you will revise the code you wrote for Project 1 based on the feedback you received in code reviews. Second, you will add a persistent log to your Raft implementation and use the replicated log to build a simple replicated state machine that executes shell commands.
Modify and refactor your Raft implementation based on the feedback you received from code reviews. I expect you to fix all of the issues that I raised in my code review (check with me if you don't think it is possible or reasonable to deal with some of my requests). My overall review comments include a few larger tasks as well. You should also incorporate most or all of the suggestions you received from other students. If you get conflicting comments from different reviewers, you can decide how to handle them (but check with me before going against any of my suggestions). You will need to make many small changes, such as improving comments, but most of you will also need to make significant changes to some of your interfaces, which will have more global ramifications.
Your overall goal should be to make your code as clean and simple as possible. Now that you've gotten feedback and had a chance to hear how other groups solved the same problems, you should have lots of ideas for how to improve your design. For example, you should refactor your abstractions to provide the simplest possible interfaces to your classes, with the best possible information hiding. Also, make your code as easy to read as possible; to do this you will need good documentation as well as a clean class structure.
Before refactoring your existing code, I recommend doing at least a rough design for the new features described below: their needs may suggest additional changes to make in the structure of your code.
Create a file changes
in the top-level directory of
your repository, which briefly describes the most significant
ways in which you improved your Project 1 code for Project 2 (what
you changed, at a high level,
and why you did it). This file can be relatively
short (10-20 lines): it's intended to make it easier for reviewers to
find the most important changes.
In addition to revising your code based on the Project 1 reviews, you will also add new features to your Raft implementation; this will give you a opportunity to apply some of the design lessons you learned during Project 1. In this project you will create a simple replicated shell: when a user types shell commands in a client application, they will be forwarded to the Raft state machine, replicated in all of the logs, and then executed as shell commands on each of the Raft servers. The new code for this project must include the following:
fopen
, std::iostream
std::fstream. If
you are not sure whether it's OK to use a particular library in
your implementation, check with me.commitIndex
to followers
as described in the Raft paper.bash
with the -c
option. Each
server should execute the command in its private working directory. Log
entries must be executed in order according to their log indices,
and only one command should execute at a time. All servers must execute
each committed command, not just the leader. When the leader
receives a client request, it should add the
command to its log, wait until the log entry has been committed and the
command has been executed, and then return to the client any output
generated by the command.project1
branch
back into the master branch of your repository. You can do this
by closing the pull request for Project 1 (select the
"Merge commit" option).project2
, and do all of your
work for this project on that branch.project2
branch, and tag
that commit commentsBeforeCode2
. Make sure that the
message for this commit also includes the name of the file. I
recommend that you
write comments before code for all your files, but I will only
require it for this one file.
To submit your project, push all of your changes to GitHub on the
project2
branch
and then create a pull request. The base for the pull
request should be your
master
branch (which now contains all of your work
up through Project 1) and the comparison branch should be the head of your
project2
branch. Use "Project 2" as the title for your pull
request. If your project is not completely functional at the time you submit,
describe what is and isn't working in the comments for the pull request.
If you are planning to use late days for this project (or any project) please send me an email before the project deadline so that I know how many late days you plan to use.