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,53 +366,63 @@ class Application(object): ...@@ -366,53 +366,63 @@ 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()
try:
cell_list = self.pt.getCellList(partition_id, readable=True)
finally:
self._pt_release()
if len(cell_list) == 0: self._pt_acquire()
sleep(1) try:
continue cell_list = self.pt.getCellList(partition_id, readable=True)
finally:
self._pt_release()
shuffle(cell_list) if len(cell_list) == 0:
self.local_var.asked_object = None # No cells available, so why are we running ?
for cell in cell_list: logging.error('oid %s not found because no storage is available for it', dump(oid))
logging.debug('trying to load %s from %s', raise NEOStorageNotFoundError()
dump(oid), dump(cell.getUUID()))
conn = self.cp.getConnForNode(cell)
if conn is None:
continue
self.local_var.asked_object = 0 shuffle(cell_list)
self.local_var.asked_object = 0
for cell in cell_list:
logging.debug('trying to load %s from %s',
dump(oid), dump(cell.getUUID()))
conn = self.cp.getConnForNode(cell)
if conn is None:
continue
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
break break
# Check data # Check data
noid, start_serial, end_serial, compression, checksum, data \ noid, start_serial, end_serial, compression, checksum, data \
= self.local_var.asked_object = self.local_var.asked_object
if noid != oid: if noid != oid:
# 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())
continue self.local_var.asked_object = -1
elif checksum != makeChecksum(data): continue
# Check checksum. elif checksum != makeChecksum(data):
logging.error('wrong checksum from node %s for oid %s', # Check checksum.
cell.getServer(), dump(oid)) logging.error('wrong checksum from node %s for oid %s',
continue cell.getServer(), dump(oid))
else: self.local_var.asked_object = -1
# Everything looks alright. continue
break 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: 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