Commit 3bcf53d2 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Keep track of store order.

This is required to export data from NEO as done by FileStorage.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2356 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 1176bdb6
......@@ -102,6 +102,7 @@ class ThreadContext(object):
'tid': None,
'txn': None,
'data_dict': {},
'data_list': [],
'object_serial_dict': {},
'object_stored_counter_dict': {},
'conflict_serial_dict': {},
......@@ -632,7 +633,11 @@ class Application(object):
checksum, compressed_data, data_serial, self.local_var.tid)
on_timeout = OnTimeout(self.onStoreTimeout, self.local_var.tid, oid)
# Store object in tmp cache
self.local_var.data_dict[oid] = data
local_var = self.local_var
data_dict = local_var.data_dict
if oid not in data_dict:
local_var.data_list.append(oid)
data_dict[oid] = data
# Store data on each node
self.local_var.object_stored_counter_dict[oid] = {}
self.local_var.object_serial_dict[oid] = serial
......@@ -705,6 +710,7 @@ class Application(object):
if not resolved:
# XXX: Is it really required to remove from data_dict ?
del data_dict[oid]
local_var.data_list.remove(oid)
raise ConflictError(oid=oid,
serials=(tid, serial), data=data)
return result
......@@ -763,7 +769,7 @@ class Application(object):
voted_counter = 0
p = Packets.AskStoreTransaction(tid, str(transaction.user),
str(transaction.description), dumps(transaction._extension),
local_var.data_dict.keys())
local_var.data_list)
add_involved_nodes = self.local_var.involved_nodes.add
for cell in self._getCellListForTID(tid, writable=True):
logging.debug("voting object %s %s", cell.getAddress(),
......@@ -845,7 +851,7 @@ class Application(object):
f(tid)
# Call finish on master
oid_list = self.local_var.data_dict.keys()
oid_list = self.local_var.data_list
p = Packets.AskFinishTransaction(tid, oid_list)
self._askPrimary(p)
......
......@@ -463,6 +463,7 @@ class ClientApplicationTests(NeoTestBase):
app.nm.createStorage(address=storage_address)
app.local_var.object_stored = (oid, tid)
app.local_var.data_dict[oid] = 'BEFORE'
app.local_var.data_list.append(oid)
app.store(oid, tid, '', None, txn)
app.local_var.queue.put((conn, packet))
self.assertRaises(ConflictError, app.waitStoreResponses,
......
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