diff --git a/product/ERP5Type/tests/testCopySupport.py b/product/ERP5Type/tests/testCopySupport.py index 711fde6b2bb31a8772b867633d607312a7ece89b..666736dda30730100016013f18db2e82c0b433e8 100644 --- a/product/ERP5Type/tests/testCopySupport.py +++ b/product/ERP5Type/tests/testCopySupport.py @@ -86,23 +86,12 @@ class TestCopySupport(ERP5TypeTestCase): self.assertTrue(person.getCareerSubordinationValue().aq_base is organisation.aq_base) def test_02_unindexObjectDependency(self): - # XXX This test passes for bad reasons. person = self.portal.person_module.newContent(portal_type='Person', address_city='Lille') self.tic() person.recursiveReindexObject() person.default_address.setId('old_address') self.commit() - # Currently, the test passes only because ActivityTool.distribute always - # iterates on queues in the same order: SQLQueue before SQLDict. - # If Python returned dictionary values in a different order, - # reindex activities would fail with the following error: - # uid of <Products.ERP5Catalog.CatalogTool.IndexableObjectWrapper for - # /erp5/person_module/1/old_address> is 599L and is already assigned - # to deleted in catalog !!! This can be fatal. - # This test would fail if: - # - SQLDict was used for 'unindexObject' - # - there were more than MAX_VALIDATED_LIMIT unindexed & reindexed objects self.tic() def test_03_unindexObjectGrouping(self): diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py index 96577e1b3146b5fccb57ff39cc2e681ccb2d962a..d5bd9d55b83a1f67325ba5bff02f5222e112a985 100644 --- a/product/ZSQLCatalog/SQLCatalog.py +++ b/product/ZSQLCatalog/SQLCatalog.py @@ -1503,6 +1503,23 @@ class Catalog(Folder, pass finally: lock.release() + elif catalog_path == 'deleted': + # Two possible cases: + # - Reindexed object's path changed (ie, it or at least one of its + # parents was renamed) but unindexObject was not called yet. + # Reindexing is harmelss: unindexObject and then an + # immediateReindexObject will be called. + # - Reindexed object was deleted by a concurrent transaction, which + # committed after we got our ZODB snapshot of this object. + # Reindexing is harmless: unindexObject will be called, and + # cannot be executed in parallel thanks to activity's + # serialisation_tag (so we cannot end up with a fantom object in + # catalog). + # So we index object. + # We could also not index it to save the time needed to index, but + # this would slow down all regular case to slightly improve an + # exceptional case. + pass elif catalog_path is not None: # An uid conflict happened... Why? # can be due to path length