Commit bcc6493c authored by Aurel's avatar Aurel

remove the while loop in load methods as it was there due to wrong

assumption, due to the protocol design we now assume that if load is
called it is because the cluster is operational and all data are reachable


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@582 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 91fcd98b
......@@ -366,7 +366,7 @@ class Application(object):
partition_id = u64(oid) % self.num_partitions
self.local_var.asked_object = None
while self.local_var.asked_object is None:
self._pt_acquire()
try:
cell_list = self.pt.getCellList(partition_id, readable=True)
......@@ -374,11 +374,12 @@ class Application(object):
self._pt_release()
if len(cell_list) == 0:
sleep(1)
continue
# No cells available, so why are we running ?
logging.error('oid %s not found because no storage is available for it', dump(oid))
raise NEOStorageNotFoundError()
shuffle(cell_list)
self.local_var.asked_object = None
self.local_var.asked_object = 0
for cell in cell_list:
logging.debug('trying to load %s from %s',
dump(oid), dump(cell.getUUID()))
......@@ -386,8 +387,10 @@ class Application(object):
if conn is None:
continue
self.local_var.asked_object = 0
try:
self._askStorage(conn, protocol.askObject(oid, serial, tid))
except NEOStorageConnectionFailure:
continue
if self.local_var.asked_object == -1:
# OID not found
......@@ -400,19 +403,26 @@ class Application(object):
# Oops, try with next node
logging.error('got wrong oid %s instead of %s from node %s',
noid, dump(oid), cell.getServer())
self.local_var.asked_object = -1
continue
elif checksum != makeChecksum(data):
# Check checksum.
logging.error('wrong checksum from node %s for oid %s',
cell.getServer(), dump(oid))
self.local_var.asked_object = -1
continue
else:
# Everything looks alright.
break
if self.local_var.asked_object == 0:
# We didn't got any object from all storage node because of connection error
logging.warning('oid %s not found because of connection failure', dump(oid))
raise NEOStorageNotFoundError()
if self.local_var.asked_object == -1:
# We didn't got any object from all storage node
logging.debug('oid %s not found', dump(oid))
logging.info('oid %s not found', dump(oid))
raise NEOStorageNotFoundError()
# Uncompress data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment