Commit d2ac0e58 authored by Vincent Pelletier's avatar Vincent Pelletier

Reorder possible cases to improve readability.

Also, extend logging.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2080 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ba43938e
...@@ -192,26 +192,30 @@ class TransactionManager(object): ...@@ -192,26 +192,30 @@ class TransactionManager(object):
if locking_tid == tid: if locking_tid == tid:
logging.info('Transaction %s storing %s more than once', dump(tid), logging.info('Transaction %s storing %s more than once', dump(tid),
dump(oid)) dump(oid))
else: elif locking_tid is None:
if locking_tid is not None:
if locking_tid < tid:
# a previous transaction lock this object, retry later
raise DelayedError
# If a newer transaction already locks this object,
# do not try to resolve a conflict, so return immediately.
logging.info('unresolvable conflict in %s', dump(oid))
raise ConflictError(locking_tid)
# check if this is generated from the latest revision. # check if this is generated from the latest revision.
history_list = self._app.dm.getObjectHistory(oid) history_list = self._app.dm.getObjectHistory(oid)
if history_list and history_list[0][0] != serial: if history_list and history_list[0][0] != serial:
logging.info('resolvable conflict in %s', dump(oid)) logging.info('Resolvable conflict on %r:%r', dump(oid),
dump(tid))
raise ConflictError(history_list[0][0]) raise ConflictError(history_list[0][0])
logging.info('Transaction %s storing %s', dump(tid), dump(oid))
self._store_lock_dict[oid] = tid
elif locking_tid < tid:
# a previous transaction lock this object, retry later
logging.info('Store delayed for %r:%r by %r', dump(oid),
dump(tid), dump(locking_tid))
raise DelayedError
else:
# If a newer transaction already locks this object,
# do not try to resolve a conflict, so return immediately.
logging.info('Unresolvable conflict on %r:%r with %r', dump(oid),
dump(tid), dump(locking_tid))
raise ConflictError(locking_tid)
# store object # store object
transaction = self._getTransaction(tid, uuid) transaction = self._getTransaction(tid, uuid)
transaction.addObject(oid, compression, checksum, data, value_serial) transaction.addObject(oid, compression, checksum, data, value_serial)
self._store_lock_dict[oid] = tid
# update loid # update loid
self._loid_seen = oid self._loid_seen = 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