-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"plone.app.contenttypes.migration.migration.migrate_folders" introduces catalog inconsistencies #556
Comments
The initial code became victim of the same effect that causes the catalog inconsistencies in the first place: the migration modifies the result of
|
The following patches solve the problem (at least for the fairly simple example case):
|
The inconsistencies (at least the strange ones with the catalog indexes inconsistent with the catalog metadata) are caused by When an object I have the strong feeling that this is primarily a bug in I have worked around the problem in my real work migration via:
This disables |
Good trick :) No uncatalog errors but after migration I run this code to check objects
and got many Archetypes objects Deep debugging shows weird thing in the createNew function. For example I am migrating two ATFolder objects:
If I migrate parent object first and then migrate child object self.parent for this child object self.parent is still Archetypes.
It seems it doesn't take newly created parent dexterity folder and takes old from memory. To fix this I have patched BaseMigrator.init method: Not sure I understand fully what's going on but your trick together with my seems to be working for me. |
Ihor Marhitych wrote at 2020-9-18 07:13 -0700:
...
No uncatalog errors but after migration I run this code to check objects
...
and got many Archetypes objects
I ran into this problem as well.
The cause have been catalog inconsistencies introduced by
`reindexObjectSecurity`. Those inconsistencies let the
catalog believe an object were already migrated while in fact
it was still an AT object. I used the following patch:
```
from Products.CMFCore.CMFCatalogAware import CatalogAware
CatalogAware.reindexObjectSecurity = lambda *args, **kw: None
```
Because the migration should not change anything regarding permissions,
it should not be necessary to do anything regarding object security.
In addition, I deactivated `CMFEditions` (no need for new
editions):
```
from Products.CMFEditions.CopyModifyMergeRepositoryTool import CopyModifyMergeRepositoryTool
CopyModifyMergeRepositoryTool.save = lambda *args, **kw: None
```
and finally, I deactivated the "UNIQUE" object check
(when an object was good before the migration, it should be good
after it as well):
```
from OFS import ObjectManager
ObjectManager.UNIQUE = 0
```
With all those patches, the migration has been successful for
my client.
|
@d-maurer Thanks for your tips,
and it didn't solve the issue. It made migration twice faster and thanks for that :) but I still have to patch BaseMigrator.init Anyway glad to hear that it wasn't just my issue and I am moving in correct direction. |
Affected version: 2.1.7
In the following transacript,
p
represents a Plone portal. A folder hierarchytest_migration
,f1
,f2
,d
is created and the catalog is patched to limit the search to objects below test_migration. Before, the call ofmigrate_folders
, the catalog is consistent; after the call, the catalog is inconsistent.The reason is a bad interaction with the
Products.CMFCore.indexing.IndexQueue
. This queue registers indexing requests for objects, more precisely acquisition wrappers for objects. Duringmigrate_folders
, migrated folders have their children removed and are renamed; the children are then added to the migrated folder. This creates indexing requests for the decendents in the queue. If during the migration a descendent is migrated, its renaming modifies those indexing requests as an unwanted side effect.The text was updated successfully, but these errors were encountered: