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): ...@@ -366,7 +366,7 @@ class Application(object):
partition_id = u64(oid) % self.num_partitions partition_id = u64(oid) % self.num_partitions
self.local_var.asked_object = None self.local_var.asked_object = None
while self.local_var.asked_object is None:
self._pt_acquire() self._pt_acquire()
try: try:
cell_list = self.pt.getCellList(partition_id, readable=True) cell_list = self.pt.getCellList(partition_id, readable=True)
...@@ -374,11 +374,12 @@ class Application(object): ...@@ -374,11 +374,12 @@ class Application(object):
self._pt_release() self._pt_release()
if len(cell_list) == 0: if len(cell_list) == 0:
sleep(1) # No cells available, so why are we running ?
continue logging.error('oid %s not found because no storage is available for it', dump(oid))
raise NEOStorageNotFoundError()
shuffle(cell_list) shuffle(cell_list)
self.local_var.asked_object = None self.local_var.asked_object = 0
for cell in cell_list: for cell in cell_list:
logging.debug('trying to load %s from %s', logging.debug('trying to load %s from %s',
dump(oid), dump(cell.getUUID())) dump(oid), dump(cell.getUUID()))
...@@ -386,8 +387,10 @@ class Application(object): ...@@ -386,8 +387,10 @@ class Application(object):
if conn is None: if conn is None:
continue continue
self.local_var.asked_object = 0 try:
self._askStorage(conn, protocol.askObject(oid, serial, tid)) self._askStorage(conn, protocol.askObject(oid, serial, tid))
except NEOStorageConnectionFailure:
continue
if self.local_var.asked_object == -1: if self.local_var.asked_object == -1:
# OID not found # OID not found
...@@ -400,19 +403,26 @@ class Application(object): ...@@ -400,19 +403,26 @@ class Application(object):
# Oops, try with next node # Oops, try with next node
logging.error('got wrong oid %s instead of %s from node %s', logging.error('got wrong oid %s instead of %s from node %s',
noid, dump(oid), cell.getServer()) noid, dump(oid), cell.getServer())
self.local_var.asked_object = -1
continue continue
elif checksum != makeChecksum(data): elif checksum != makeChecksum(data):
# Check checksum. # Check checksum.
logging.error('wrong checksum from node %s for oid %s', logging.error('wrong checksum from node %s for oid %s',
cell.getServer(), dump(oid)) cell.getServer(), dump(oid))
self.local_var.asked_object = -1
continue continue
else: else:
# Everything looks alright. # Everything looks alright.
break 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: if self.local_var.asked_object == -1:
# We didn't got any object from all storage node # 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() raise NEOStorageNotFoundError()
# Uncompress data # 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