Commit de9729b9 authored by Jérome Perrin's avatar Jérome Perrin

do not commit transactions in checkConsistency. Only keep some subtransaction commit when fixing.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9429 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 32cb883a
...@@ -603,11 +603,12 @@ be a problem).""" ...@@ -603,11 +603,12 @@ be a problem)."""
return Base.getCategoryMembershipList(self, category, return Base.getCategoryMembershipList(self, category,
spec=spec, filter=filter, portal_type=portal_type, base=base) spec=spec, filter=filter, portal_type=portal_type, base=base)
# Alias - class inheritance resolutino # Alias - class inheritance resolution
security.declareProtected( Permissions.View, 'Title' ) security.declareProtected( Permissions.View, 'Title' )
Title = Base.Title Title = Base.Title
security.declareProtected(Permissions.AccessContentsInformation, 'checkConsistency') security.declareProtected(Permissions.AccessContentsInformation,
'checkConsistency')
def checkConsistency(self, fixit=0): def checkConsistency(self, fixit=0):
""" """
Check the consistency of this object, then Check the consistency of this object, then
...@@ -619,30 +620,23 @@ be a problem).""" ...@@ -619,30 +620,23 @@ be a problem)."""
btree_ok = self._cleanup() btree_ok = self._cleanup()
if not btree_ok: if not btree_ok:
# We must commit if we want to keep on recursing # We must commit if we want to keep on recursing
get_transaction().commit() get_transaction().commit(1)
error_list += [(self.getRelativeUrl(), 'BTree Inconsistency', error_list += [(self.getRelativeUrl(), 'BTree Inconsistency',
199, '(fixed)')] 199, '(fixed)')]
# Call superclass # Call superclass
error_list += Base.checkConsistency(self, fixit=fixit) error_list += Base.checkConsistency(self, fixit=fixit)
# We must commit before listing folder contents # We must commit before listing folder contents
# in case we erased some data # in case we erased some data
if fixit: get_transaction().commit() if fixit:
get_transaction().commit(1)
# Then check the consistency on all sub objects # Then check the consistency on all sub objects
for object in self.contentValues(): for obj in self.contentValues():
if fixit: if fixit:
extra_errors = object.fixConsistency() extra_errors = obj.fixConsistency()
else: else:
extra_errors = object.checkConsistency() extra_errors = obj.checkConsistency()
if len(extra_errors) > 0: if len(extra_errors) > 0:
error_list += extra_errors error_list += extra_errors
# Commit after each subobject
#if fixit:
# XXX it is bad to use except without exception name !
# try:
get_transaction().commit()
# except:
# LOG("Folder WARNING",0,
# "Could not commit checkConsistency transaction for object %s" % object.getRelativeUrl())
# We should also return an error if any # We should also return an error if any
return error_list return error_list
......
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