Commit 49f8deb9 authored by Jérome Perrin's avatar Jérome Perrin

ERP5Type: add a transaction note when bootstraping

Bootstrap is actually the automatic migration of tools. It happened to me
several times that I mistakenly start an old instance on a too new version of
products and this instance is migrated automatically.

By leaving a note in transaction it's easier to find out which
transaction performed the automatic migration to revert to the state
before using technique such as
https://blog.gocept.com/2019/06/14/undo-transactions-by-truncating-zodb-data-fs/
for FileStorage.

with this change, a command such as;

    python -m ZODB.scripts.fstail -n 20 ./instance/slappart6/srv/zodb/root.fs

show something like:

    2019-10-31 08:48:54.187398: hash=3adb3ad9f5f3acf72d03ddeea4d223148a3594a5
    user=' None' description="/timer_service/process_timer\nBootstraping <class 'Products.ERP5Type.Tool.PropertySheetTool.PropertySheetTool'>\nBootstraping <class 'Products.ERP5Catalog.Tool.ERP5CatalogTool.ERP5CatalogTool'>" length=463087 offset=881877846 (+219)

for the transaction which did the migration, so it's easy to repair.
parent 969c3e23
......@@ -446,6 +446,7 @@ def synchronizeDynamicModules(context, force=False):
migrate = True
else:
continue
transaction.get().note('Bootstraping %s' % tool_class)
tool._bootstrap()
tool.__class__ = getattr(erp5.portal_type, tool.portal_type)
# TODO: Create portal_activities here, and even before portal_types:
......
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