Commit 150b0074 authored by Aurel's avatar Aurel

if connection to SN failed in store method, treatment goes on except

if no store at all can be done


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@583 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent bcc6493c
...@@ -518,16 +518,20 @@ class Application(object): ...@@ -518,16 +518,20 @@ class Application(object):
# Store data on each node # Store data on each node
compressed_data = compress(data) compressed_data = compress(data)
checksum = makeChecksum(compressed_data) checksum = makeChecksum(compressed_data)
self.local_var.object_stored_counter = 0
for cell in cell_list: for cell in cell_list:
#logging.info("storing object %s %s" %(cell.getServer(),cell.getState())) #logging.info("storing object %s %s" %(cell.getServer(),cell.getState()))
conn = self.cp.getConnForNode(cell) conn = self.cp.getConnForNode(cell)
if conn is None: if conn is None:
continue continue
self.local_var.object_stored = 0 self.local_var.object_stored = 0
p = protocol.askStoreObject(oid, serial, 1, p = protocol.askStoreObject(oid, serial, 1,
checksum, compressed_data, self.local_var.tid) checksum, compressed_data, self.local_var.tid)
self._askStorage(conn, p) try:
self._askStorage(conn, p)
except NEOStorageConnectionFailure:
continue
# Check we don't get any conflict # Check we don't get any conflict
if self.local_var.object_stored[0] == -1: if self.local_var.object_stored[0] == -1:
...@@ -539,7 +543,13 @@ class Application(object): ...@@ -539,7 +543,13 @@ class Application(object):
del self.local_var.data_dict[oid] del self.local_var.data_dict[oid]
self.conflict_serial = self.local_var.object_stored[1] self.conflict_serial = self.local_var.object_stored[1]
raise NEOStorageConflictError raise NEOStorageConflictError
# increase counter so that we know if a node has stored the object or not
self.local_var.object_stored_counter += 1
if self.local_var.object_stored_counter == 0:
# no storage nodes were available
raise NEOStorageError('tpc_store failed')
# Store object in tmp cache # Store object in tmp cache
noid, nserial = self.local_var.object_stored noid, nserial = self.local_var.object_stored
self.local_var.data_dict[oid] = data self.local_var.data_dict[oid] = 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