Creating a consistent multi-node database using independent nodes.
The problem statement and setup of cassandra has been shamelessly copied
from Prof. Arun V. class (590CC Cloud Computing- PA2)
https://docs.google.com/document/d/1-iBuA-rmW9SSMUQinYRdJsi8kuh7qRwIMphJOUzo36I/edit
I used ant for building jars and then realized that
I needed to add datastax which had its on dependencies. So I used
maven to fill up the library and ant for build.(Lesson: Next time stick with Maven)
A Makefile contains a more consice way of building everything
Clears the logs, frees up ports and deploys servers.
Download all dependencies into lib/ (mkdir lib if not exists) by doing:
mvn dependency:copy-dependencies -DoutputDirectory=lib
Create a keyspace in both the nodes called ‘repl1’.
CREATE KEYSPACE repl1
WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
make server (deploys the 2 server. Its just a quick way to run a sequence of commands)
To test Server centric consistency:
ant run-client://Run in terminal 1
12347:localhost "insert into table1(id,col1) values (10,'seven');"
ant run-client://Run in terminal 2
12345:localhost "insert into table1(id,col1) values (11,'seven');"
update 1 happens before update 2 in both nodes. As can be confirmed from the logs
To test Client-centric consistency:
ant run-client://
12347:localhost "insert into table1(id,col1) values (10,'seven');"
12345:localhost "select * from table1;"
This should return database stale for 10 seconds after which as the update gets
propagated. The actual value is returned.
Lamport clock should be persistant and stored in the Database
Used course grained single lock. Can improve performance by having
fine grained lock.