about hash calculation in reference page at docs.basho.com

Donald Yan dyan.ddn at gmail.com
Thu Jan 24 00:05:45 EST 2013


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:

(dev1 at 127.0.0.1)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>>
(dev1 at 127.0.0.1)6> I.1045375627425331784151332358177649483819648417632

The node looks up the hashed key in the ring which returns a list of
“preferred” partitions for the given key.

(node1 at 127.0.0.1)> Preflist = riak_core_ring:preflist(DocIdx, Ring).
[{1096126227998177188652763624537212264741949407232, 'dev1 at 127.0.0.1'},
{1278813932664540053428224228626747642198940975104, 'dev2 at 127.0.0.1'},
{0, 'dev1 at 127.0.0.1'},
{182687704666362864775460604089535377456991567872, 'dev2 at 127.0.0.1'},
{365375409332725729550921208179070754913983135744, 'dev3 at 127.0.0.1'},
{548063113999088594326381812268606132370974703616, 'dev1 at 127.0.0.1'},
{730750818665451459101842416358141509827966271488, 'dev2 at 127.0.0.1'},
{913438523331814323877303020447676887284957839360, 'dev3 at 127.0.0.1'}]


"

I question is since the key is  calculated as "
1045375627425331784151332358177649483819648417632", shouldn't the prefer
list be like the following instead?
"
[{913438523331814323877303020447676887284957839360, 'dev3 at 127.0.0.1'},
{1096126227998177188652763624537212264741949407232, 'dev1 at 127.0.0.1'},
{1278813932664540053428224228626747642198940975104, 'dev2 at 127.0.0.1'},
{0, 'dev1 at 127.0.0.1'},
{182687704666362864775460604089535377456991567872, 'dev2 at 127.0.0.1'},
{365375409332725729550921208179070754913983135744, 'dev3 at 127.0.0.1'},
{548063113999088594326381812268606132370974703616, 'dev1 at 127.0.0.1'},
{730750818665451459101842416358141509827966271488, 'dev2 at 127.0.0.1'}]
"
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20130123/ac8fc5fc/attachment.html>


More information about the riak-users mailing list