Nextar
Nextar

Reputation: 1098

Test Cassandras R + W > N

I want to explicitly show the R + W > N rule at a presentation.

So my initial idea how to do this is as following:

// setup
1: Create a Docker network with 3 Cassandra Nodes.  
2: Create a simple Keyspace with Replication-Factor of 3.  
3: Explicitly shutdown two of the docker nodes.

4: Create a write query inserting some data with W=1
   As two of the nodes are down but one is still online this should succeed

5: Bring both of the nodes back online
6: Reading the Data I just pushed to one node with R=1

If I understand R + W > N correctly I should now have the chance of 2/3 to get inconsistent data. Which is exactly what I want to show.

My Question is:
Is there an option I need to disable in order to stop nodes from syncing when they get back online?

So I would require to disable these options ?

Upvotes: 1

Views: 54

Answers (1)

Alex Ott
Alex Ott

Reputation: 87119

You need to disable hints on all nodes (set hinted_handoff_enabled in cassandra.yaml to false) - in this case, replication will happen only when you explicitly do the nodetool repair.

You also need to make sure that read_repair_chance and dclocal_read_repair_chance are set to 0 for a table where you'll do the test. The easiest way is just to specify these options when creating the table:

create table (

....)
WITH read_repair_chance = 0.0 and dclocal_read_repair_chance = 0.0;

Upvotes: 1

Related Questions