Commit 468b503b authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: [Data Recovery] Skip full reindexation if isn't needed

   If the mariadb is more recent (and consitent) them the ZODB, it isn't needed to full reindex since all
   changed objects are visible in the catalog. So it is safe enough only partially reindex.
parent e200fcad
...@@ -5,10 +5,15 @@ before = now - int(7) ...@@ -5,10 +5,15 @@ before = now - int(7)
strfstring = '%Y-%m-%d %H:%M:%S' strfstring = '%Y-%m-%d %H:%M:%S'
portal.ERP5Site_checkLatestModifiedDocumentList(0, 1000, 100, before.strftime(strfstring), now.strftime(strfstring)) portal.ERP5Site_checkLatestModifiedDocumentList(0, 1000, 100,
before.strftime(strfstring), now.strftime(strfstring))
# Force reindexation of recently created document # Force reindexation of recently created document
# This expect module to use HBTree # This expect module to use HBTree
# The following category could be consider as "non-optimistic", but
# it is minimal compared to a whole reindex and it is safe to prevent
# Minor inconsistencies.
for module_id in portal.objectIds(("ERP5 Folder",)): for module_id in portal.objectIds(("ERP5 Folder",)):
if module_id.endswith("_module"): if module_id.endswith("_module"):
portal[module_id].recurseCallMethod( portal[module_id].recurseCallMethod(
...@@ -22,7 +27,15 @@ for module_id in portal.objectIds(("ERP5 Folder",)): ...@@ -22,7 +27,15 @@ for module_id in portal.objectIds(("ERP5 Folder",)):
portal.ERP5Site_checkDeletedDocumentList(0, 1000, 100) portal.ERP5Site_checkDeletedDocumentList(0, 1000, 100)
for module_id in [
# Whenever we trust that the catalog is consistent and more recent them the
# ZODB, it isn't required to trigger the whole reindexation of the site.
# If the Mariadb is eventually inconsitent or older them the current ZODB,
# It's required reindex the whole site.
if not optimistic:
for module_id in [
'portal_preferences', 'portal_preferences',
'portal_categories', 'portal_categories',
'portal_alarms', 'portal_alarms',
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string>optimistic=True</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
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