


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Assignment Out: February 26, 2008 Assignment Due: March 13, 2008 (11:59 pm)
Now that you have a replicated system that keeps all of its members up to date, it’s time to think about data consistency. If several clients simultaneously send conflicting updates to two or more different servers, or attempt to add data with the same key, your database should take it in stride and provide a consistent view of the data.
You’re going to add a feature to SDDB – the ability to make “quorum” updates. In a quorum update, instead of updating the database on a node directly, it sends a “quorum request” to the other nodes. When a majority of nodes in the system have agreed to update the database, an authoritative update is propagated and every node updates its database at that time.
Your system should return only data that has been successfully integrated into the entire database. If a quorum is in progress, the data that is being decided upon should not be visible in the database.
Note that it may sometimes be impossible to commit an update - for example, if there are only two servers in the system and each is given a conflicting version of the same update, neither will be able to acquire a majority. What is important is not that each change be accepted by the system, but that it maintains a consistent state across all servers. Keep in mind that if a new update is requested with no conflict after the above example takes place, it should pass the quorum and commit the update.
Finally, our usage of ‘update’ is ambigious, and may refer to either an ‘add’ (adding a new key to the database) or an update (modifying an existing key in the database).
For this assignment, you will be modifying the structure of your tree that you set up in SDDB. In SDDB, each node contacted the root directly in order to propagate updates. You should now
change this to a more mature system where each node propagates messages directly to its parent and/or its children. This allows for a more distributed architecture and reduces a single point of failure. This will become especially important in the next project, where you will make your database more fault-tolerant.
In order to implement the quorum semantics, your nodes will have to be prepared to create quorums and participate in quorums, and also interact with the newly-added election numbers. The following sections explain the semantics of each.
While participating in a quorum, you will have to place your vote. The mechanism that provides these semantics are election numbers. We have updated the DBData class to include this information. Each key in the database now stores both the datum and an ”‘election number”’ representing the version of the datum. You should interact with it in the following way:
You should think about why this ensures that when two quorums occur concurrently, each node will vote ‘yes’ on at most one of them. Come see the TAs on hours if you are unsure. The helpsession will present various examples to illustrate this mechanism.
There are multiple steps to creating a quorum. When a node wants to perform a quorum update (meaning the quorum_put method was invoked), it will do the following:
5 Code Exchange
We have provided you with a new interface to implement called DDBQuorum. It provides a method quorum put which should create a quorum to decide whether to commit the given datum to the database. quorum put has an additional argument, the SuccessListener, which is a callback to the user when the result of the quorum is determined. If the quorum is successful, the success method is invoked, and if the quorum fails, the failure method is invoked. We have also provided you with a new version of DBData which has election numbers.
You should clone your sddb directory source directory, and then copy the code from /course/cs138/asgn/quorum into it, overwriting conflicting files.
As usual, you should write a README to document notable bugs and features, as well as other information that you think the TAs should know.
To hand in quorum, run the following script from the directory containing your source code:
/course/cs138/bin/cs138 handin quorum
6 Extra Credit
Feel free to create your own extra credit projects, but be sure to run your idea past a TA beforehand if you want to be sure to get points for your additional work.