On Jan 10, 2012, at 2:46 PM, John DeTreville wrote:

> A related question. You say that if my n_val is 3, some data may reside only 
> on 2 physical nodes. Ignoring failures, might some of it of reside on just 
> one node?

That's a function of ring size and number of nodes in your cluster. For 
example, if you have a 1 node cluster and n_val is 3, obviously all 3 replicas 
will be on a single physical node.

Now, let's say you had a ring size of 8 and 3 physical nodes. When Riak 
partitions the ring and decides which nodes will act as the primary node for 
each partition, it will look something like this:

0 = dev1
1 = dev 2
2 = dev 3
3 = dev 1
4 = dev 2
5 = dev 3
6 = dev 1
7 = dev 2

Now, when we go to hash an object into the ring, it will end up going to one of 
those 8 partitions (0-7), and it will get replicated on partitions P+1 and P+2 
(for n_val = 3). For example, if an object were to get hashed to partition 0, 
then it would exist on partitions 0, 1, and 2, and be replicated on physical 
nodes dev1, dev2, and dev3.

But, as you can see, 8 (partitions) is not evenly divisible by 3 (nodes), so, 
if an object were to hash to partition 6 (or 7), where it would replicate two 
actually wraps around the ring to partitions 6, 7, and 0, being replicated on 
only 2 physical nodes (dev1 twice and dev2 once).

Throwing out really contrived cases to make the math work (ring size=1, 
n_val=1, # nodes=1, etc), and ignoring failures, then no, you shouldn't ever 
have a case where you specify n_val > 2 and end up with a situation where all 
the replicas end up on a single, physical node.

--
Jeffrey Massung
Software Engineer
j...@basho.com
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to