--- a/hooks/integrity.py Tue Feb 09 11:22:40 2010 +0100
+++ b/hooks/integrity.py Tue Feb 09 12:41:44 2010 +0100
@@ -27,6 +27,7 @@
_UNIQUE_CONSTRAINTS_LOCK = Lock()
_UNIQUE_CONSTRAINTS_HOLDER = None
+
def _acquire_unique_cstr_lock(session):
"""acquire the _UNIQUE_CONSTRAINTS_LOCK for the session.
@@ -34,19 +35,17 @@
RQLUniqueConstraint in two different transactions, as explained in
http://intranet.logilab.fr/jpl/ticket/36564
"""
- global _UNIQUE_CONSTRAINTS_HOLDER
asession = session.actual_session()
- if _UNIQUE_CONSTRAINTS_HOLDER is asession:
+ if 'uniquecstrholder' in asession.transaction_data:
return
_UNIQUE_CONSTRAINTS_LOCK.acquire()
- _UNIQUE_CONSTRAINTS_HOLDER = asession
+ asession.transaction_data['uniquecstrholder'] = True
# register operation responsible to release the lock on commit/rollback
- _ReleaseUniqueConstraintsOperation(asession)
+ _ReleaseUniqueConstraintsHook(asession)
def _release_unique_cstr_lock(session):
- global _UNIQUE_CONSTRAINTS_HOLDER
- if _UNIQUE_CONSTRAINTS_HOLDER is session:
- _UNIQUE_CONSTRAINTS_HOLDER = None
+ if 'uniquecstrholder' in session.transaction_data:
+ del session.transaction_data['uniquecstrholder']
_UNIQUE_CONSTRAINTS_LOCK.release()
class _ReleaseUniqueConstraintsOperation(hook.Operation):
--- a/server/repository.py Tue Feb 09 11:22:40 2010 +0100
+++ b/server/repository.py Tue Feb 09 12:41:44 2010 +0100
@@ -934,7 +934,7 @@
"""full text index a modified entity"""
alreadydone = session.transaction_data.setdefault('indexedeids', set())
if entity.eid in alreadydone:
- self.info('skipping reindexation of %s, already done', entity.eid)
+ self.debug('skipping reindexation of %s, already done', entity.eid)
return
alreadydone.add(entity.eid)
self.system_source.fti_index_entity(session, entity)
--- a/server/session.py Tue Feb 09 11:22:40 2010 +0100
+++ b/server/session.py Tue Feb 09 12:41:44 2010 +0100
@@ -501,7 +501,7 @@
except:
self.critical('error while %sing', trstate,
exc_info=sys.exc_info())
- self.debug('%s session %s done', trstate, self.id)
+ self.info('%s session %s done', trstate, self.id)
finally:
self._touch()
self.commit_state = None
--- a/server/sources/native.py Tue Feb 09 11:22:40 2010 +0100
+++ b/server/sources/native.py Tue Feb 09 12:41:44 2010 +0100
@@ -552,7 +552,7 @@
def fti_index_entity(self, session, entity):
"""add text content of a created/modified entity to the full text index
"""
- self.info('reindexing %r', entity.eid)
+ self.debug('reindexing %r', entity.eid)
try:
self.indexer.cursor_reindex_object(entity.eid, entity,
session.pool['system'])