Hi

RF 2 means that 2 nodes are responsible for any given row (no matter how many 
nodes are in the cluster)
For your cluster with three nodes let's just assume the following 
responsibilities

Node            A               B               C
Primary keys    0-5             6-10            11-15
Replica keys    11-15           0-5             6-10

Assume node 'C' is down
Writing any key in range 0-5 with consistency TWO is possible (A and B are up)
Writing any key in range 11-15 with consistency TWO will fail (C is down and 
11-15 is its primary range)
Writing any key in range 6-10 with consistency TWO will fail (C is down and it 
is the replica for this range)

I hope this explains it.

-----Ursprüngliche Nachricht-----
Von: Vasileios Vlachos [mailto:vasileiosvlac...@gmail.com] 
Gesendet: Mittwoch, 19. Dezember 2012 17:07
An: user@cassandra.apache.org
Betreff: Replication Factor and Consistency Level Confusion

Hello All,

We have a 3-node cluster and we created a keyspace (say Test_1) with 
Replication Factor set to 3. I know is not great but we wanted to test 
different behaviors. So, we created a Column Family (say cf_1) and we tried 
writing something with Consistency Level ANY, ONE, TWO, THREE, QUORUM and ALL. 
We did that while all nodes were in UP state, so we had no problems at all. No 
matter what the Consistency Level was, we were able to insert a value.

Same cluster, different keyspace (say Test_2) with Replication Factor set to 2 
this time and one of the 3 nodes deliberately DOWN. Again, we created a Column 
Family (say cf_1) and we tried writing something with different Consistency 
Levels. Here is what we got:
ANY: worked (expected...)
ONE: worked (expected...)
TWO: did not work (WHAAAAT???)
THREE: did not work (expected...)
QUORUM: worked (expected...)
ALL: did not work (expected I guess...)

Now, we know that QUORUM derives from (RF/2)+1, so we were expecting that to 
work, after all only 1 node was DOWN. Why did Consistency Level TWO not work 
then???

Third test... Same cluster again, different keyspace (say Test_3) with 
Replication Factor set to 3 this time and 1 of the 3 nodes deliberately DOWN 
again. Same approach again, created different Column Family (say cf_1) and 
different Consistency Level settings resulted in the following:
ANY: worked (whaaaaat???)
ONE: worked (whaaaaat???)
TWO: did not work (whaaaaat???)
THREE: did not work (expected...)
QUORUM: worked (whaaaaat???)
ALL: worked (whaaaaat???)

We thought that if the Replication Factor is greater than the number of nodes 
in the cluster, writes are blocked.

Apparently we are completely missing the a level of understanding here, so we 
would appreciate any help!

Thank you in advance!

Vasilis


Reply via email to