the problem of adding many lookups and storages and the same time.

2 views
Skip to first unread message

spacelee

unread,
Aug 27, 2009, 9:02:42 AM8/27/09
to LightCloud
Your comment:
i have tested lightcloud recently, and for some purposes, i rewrite
the hashring and lightcloud in php, but during the time, some problems
puzzled me

when you add many lookup and storage nodes at the same time, in
theory, the code "if lookups > 2 return None" will make the get can't
find the existed data...although the coincidence is very low...

--------------------------------------------

def locate_node(key, system='default'):
"""Locates a node in the lookup ring, returning its storage node
or `None` if the storage node isn't found.
"""
nodes = get_lookup_ring(system).iterate_nodes(key)
#print nodes

for lookups, node in enumerate(nodes):

if lookups > 2:
return None

value = node.get(key)

if value:
break

if not value:
return None

if lookups == 0:
#print '_clean_up_ringfor %s' % (value)
return get_storage_node(value, system)
else:
print '_clean_up_ringfor %s' % (key)
return _clean_up_ring(key, value, system)

spacelee

unread,
Aug 27, 2009, 9:05:40 AM8/27/09
to LightCloud
Reply all
Reply to author
Forward
0 new messages