Commit 3a93658b authored by Julien Muchembled's avatar Julien Muchembled

client: comment TransactionContainer and drop duplicate 'object_base_serial_dict'

parent 9eb06ff1
...@@ -55,6 +55,8 @@ if SignalHandler: ...@@ -55,6 +55,8 @@ if SignalHandler:
class TransactionContainer(dict): class TransactionContainer(dict):
# IDEA: Drop this container and use the new set_data/data API on
# transactions (requires transaction >= 1.6).
def pop(self, txn): def pop(self, txn):
return dict.pop(self, id(txn), None) return dict.pop(self, id(txn), None)
...@@ -74,17 +76,24 @@ class TransactionContainer(dict): ...@@ -74,17 +76,24 @@ class TransactionContainer(dict):
'queue': SimpleQueue(), 'queue': SimpleQueue(),
'txn': txn, 'txn': txn,
'ttid': None, 'ttid': None,
# data being stored
'data_dict': {}, 'data_dict': {},
'data_size': 0, 'data_size': 0,
# data stored: this will go to the cache on tpc_finish
'cache_dict': {}, 'cache_dict': {},
'cache_size': 0, 'cache_size': 0,
'object_base_serial_dict': {}, # serial being stored
'object_serial_dict': {}, 'object_serial_dict': {}, # {oid: serial}
'object_stored_counter_dict': {}, # track successful stores/checks
'conflict_serial_dict': {}, 'object_stored_counter_dict': {}, # {oid: {serial: {storage_id}}}
'resolved_conflict_serial_dict': {}, # conflicts to resolve
'involved_nodes': set(), 'conflict_serial_dict': {}, # {oid: {serial}}
'checked_nodes': set(), # resolved conflicts
'resolved_conflict_serial_dict': {}, # {oid: {serial}}
# nodes with at least 1 store (object or transaction)
'involved_nodes': set(), # {node}
# nodes with at least 1 check
'checked_nodes': set(), # {node}
} }
return context return context
...@@ -443,7 +452,6 @@ class Application(ThreadedApplication): ...@@ -443,7 +452,6 @@ class Application(ThreadedApplication):
txn_context['data_dict'][oid] = data txn_context['data_dict'][oid] = data
# Store data on each node # Store data on each node
txn_context['object_stored_counter_dict'][oid] = {} txn_context['object_stored_counter_dict'][oid] = {}
txn_context['object_base_serial_dict'].setdefault(oid, serial)
txn_context['object_serial_dict'][oid] = serial txn_context['object_serial_dict'][oid] = serial
queue = txn_context['queue'] queue = txn_context['queue']
involved_nodes = txn_context['involved_nodes'] involved_nodes = txn_context['involved_nodes']
...@@ -478,7 +486,6 @@ class Application(ThreadedApplication): ...@@ -478,7 +486,6 @@ class Application(ThreadedApplication):
append = result.append append = result.append
# Check for conflicts # Check for conflicts
data_dict = txn_context['data_dict'] data_dict = txn_context['data_dict']
object_base_serial_dict = txn_context['object_base_serial_dict']
object_serial_dict = txn_context['object_serial_dict'] object_serial_dict = txn_context['object_serial_dict']
conflict_serial_dict = txn_context['conflict_serial_dict'].copy() conflict_serial_dict = txn_context['conflict_serial_dict'].copy()
txn_context['conflict_serial_dict'].clear() txn_context['conflict_serial_dict'].clear()
...@@ -559,8 +566,6 @@ class Application(ThreadedApplication): ...@@ -559,8 +566,6 @@ class Application(ThreadedApplication):
dump(conflict_serial)) dump(conflict_serial))
# Mark this conflict as resolved # Mark this conflict as resolved
resolved_serial_set.update(conflict_serial_set) resolved_serial_set.update(conflict_serial_set)
# Base serial changes too, as we resolved a conflict
object_base_serial_dict[oid] = conflict_serial
# Try to store again # Try to store again
self._store(txn_context, oid, conflict_serial, new_data) self._store(txn_context, oid, conflict_serial, new_data)
append(oid) append(oid)
......
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