Donald:

Since we are traversing the ring in a clockwise fashion, the data is written 
into the next partition you would run into moving forward.  You can see how the 
partitions are chosen in chash:ordered_from/2 at 
https://github.com/basho/riak_core/blob/master/src/chash.erl#L138.  The 
preference list is built using the partitions that come after the hashed value.

If you consider the partition's name to be the end value that the partition 
holds, the an object that hashes to 
1045375627425331784151332358177649483819648417632 being assigned to 
1096126227998177188652763624537212264741949407232 makes sense. That partition 
would hold items that hash from 
913438523331814323877303020447676887284957839361 to 
1096126227998177188652763624537212264741949407232


Does this help?

Thanks,
Charlie Voiselle


On Jan 24, 2013, at 12:05 AM, Donald Yan <[email protected]> wrote:

> Hi there,
> 
> I'm reading this page at 
> http://docs.basho.com/riak/latest/references/appendices/concepts/Replication/#Understanding-replication-by-example
>  and have a question about the example given in the page.  I quote it here:
> "
> The DocIdx hash is a 160 bit integer:
> 
> ([email protected])5> <<I:160/integer>> = DocIdx.
> <<183,28,67,173,80,128,26,94,190,198,65,15,27,243,135,127,121,101,255,96>>
> ([email protected])6> I.
> 1045375627425331784151332358177649483819648417632
> The node looks up the hashed key in the ring which returns a list of 
> “preferred” partitions for the given key.
> 
> ([email protected])> Preflist = riak_core_ring:preflist(DocIdx, Ring).
> [{1096126227998177188652763624537212264741949407232, '[email protected]'},
> {1278813932664540053428224228626747642198940975104, '[email protected]'},
> {0, '[email protected]'},
> {182687704666362864775460604089535377456991567872, '[email protected]'},
> {365375409332725729550921208179070754913983135744, '[email protected]'},
> {548063113999088594326381812268606132370974703616, '[email protected]'},
> {730750818665451459101842416358141509827966271488, '[email protected]'},
> {913438523331814323877303020447676887284957839360, '[email protected]'}]
> 
> "
> 
> I question is since the key is  calculated as 
> "1045375627425331784151332358177649483819648417632", shouldn't the prefer 
> list be like the following instead?
> "
> [{913438523331814323877303020447676887284957839360, '[email protected]'},
> {1096126227998177188652763624537212264741949407232, '[email protected]'},
> {1278813932664540053428224228626747642198940975104, '[email protected]'},
> {0, '[email protected]'},
> {182687704666362864775460604089535377456991567872, '[email protected]'},
> {365375409332725729550921208179070754913983135744, '[email protected]'},
> {548063113999088594326381812268606132370974703616, '[email protected]'},
> {730750818665451459101842416358141509827966271488, '[email protected]'}]
> "
> because value "1045375627425331784151332358177649483819648417632" falls 
> between 913438523331814323877303020447676887284957839360 (partition 5) and 
> 1096126227998177188652763624537212264741949407232 (partition 6)?
> 
> Please Riak experts help to clear my confusion here.  Why partition 6, 7, 0 
> are on the top 3 of the list?
> 
> Appreciate in advance.
> 
> 
> -donald
> _______________________________________________
> riak-users mailing list
> [email protected]
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to