[MAGNOLIA-7352] Unable to refresh index rules warning when upgrade from 5.4.x to 5.7.x Created: 26/Jul/18  Updated: 26/Jul/18  Resolved: 26/Jul/18

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 5.7
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Ngoc Nguyenthanh Assignee: Unassigned
Resolution: Workaround exists Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MAGNOLIA-7197 Startup errors when using Java 9 Closed
relates to DOCU-1636 Known issue on upgrade from 5.4.x to ... Closed
relates to MAGNOLIA-7231 Website specific rules for indexing a... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

 Steps to reproduce

  • Upgrade from 5.4.x to 5.7.x directly by using script from https://git.magnolia-cms.com/users/fgrilli/repos/update-magnolia/browse
  • The log will be flooded with warning from the IndexingConfigurationImpl
  • 2018-07-25 17:48:33,325 INFO  info.magnolia.jackrabbit.lucene.SearchIndex       : Workspace specific indexing configuration {/info/magnolia/jackrabbit/indexing_configuration_keystore.xml} was not found. Will use {/info/magnolia/jackrabbit/indexing_configuration_default.xml} instead.
    2018-07-25 17:48:33,549 INFO  info.magnolia.jackrabbit.ProviderImpl             : Custom node types registered using /mgnl-nodetypes/magnolia-contacts-nodetypes.xml
    2018-07-25 17:48:33,551 INFO  info.magnolia.jackrabbit.ProviderImpl             : Custom node types registered using /mgnl-nodetypes/magnolia-google-sitemap-nodetypes.xml
    2018-07-25 17:48:33,553 INFO  info.magnolia.jackrabbit.ProviderImpl             : Custom node types registered using /mgnl-nodetypes/magnolia-rssaggregator-nodetypes.xml
    2018-07-25 17:48:33,555 INFO  info.magnolia.jackrabbit.ProviderImpl             : Custom node types registered using /mgnl-nodetypes/magnolia-category-nodetypes.xml
    2018-07-25 17:48:33,557 INFO  info.magnolia.jackrabbit.ProviderImpl             : Custom node types registered using /mgnl-nodetypes/magnolia-tour-nodetypes.xml
    2018-07-25 17:48:33,675 INFO  ia.setup.nodetype.AbstractNodeTypeRegistrationTask: Unregistered the following NodeTypes '[mgnl:asset, mgnl:content, mgnl:item, mgnl:role, mgnl:user, mgnl:group, mgnl:systemMessage, mgnl:rssAggregator, mgnl:page, mgnl:category, mgnl:siteMap, mgnl:contact, mgnl:deleted, mgnl:versionable]'.
    2018-07-25 17:48:33,676 INFO  ia.setup.nodetype.AbstractNodeTypeRegistrationTask: In order to unregister 'mgnl:versionable', the following depending node types have been unregistered first: [mgnl:asset, mgnl:content, mgnl:item, mgnl:role, mgnl:user, mgnl:group, mgnl:systemMessage, mgnl:rssAggregator, mgnl:page, mgnl:category, mgnl:siteMap, mgnl:contact, mgnl:deleted].
    2018-07-25 17:48:33,676 INFO  ia.setup.nodetype.AbstractNodeTypeRegistrationTask: Registering 'mgnl:versionable' and the following depending nodeTypes: [mgnl:asset, mgnl:content, mgnl:item, mgnl:role, mgnl:user, mgnl:group, mgnl:systemMessage, mgnl:rssAggregator, mgnl:page, mgnl:category, mgnl:siteMap, mgnl:contact, mgnl:deleted]
    2018-07-25 17:48:33,691 WARN  rabbit.core.query.lucene.IndexingConfigurationImpl: Unable to refresh index rules
    javax.jcr.nodetype.NoSuchNodeTypeException: {http://www.magnolia.info/jcr/mgnl}page
    	at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getNodeTypeDef(NodeTypeRegistry.java:552) ~[jackrabbit-core-2.16.1.jar:2.16.1]
    
  • The system still work without restarting. Warnings will not be showed again after the migration.
     

Reasons

  • After upgraded to Jackrabbit 2.16.1 in the ticket MAGNOLIA-7285, Jackrabbit will show warnings while refresh indexing rules whenever it can't find a node type definition. Old Jackrabbit version used node type name only, then the issue will not happen.
  • In CoreModuleVersionHandler we have a task to update Versionable node type came from the ticket MAGNOLIA-6560 
  • register(DeltaBuilder.update("5.5", "")
                    .addTask(new MigrateVersionWorkspacesToNewStructureTask(repositoryManager))
                    .addTasks(getLockableMixinAdditionTasksForAllWorkspaces())
    
  • The task AddLockableMixinToVersionableMixinTask will try to un-register "mgnl:versionable" before re-register with new updates. However "mgnl:versionable" is a supertypes of many other node types and "mgnl:page" is one of them. They should be un-registered before "mgnl:versionable" can be re-registered.
  • Unfortunately, before "mgnl:page" can be registered, Jackrabbit try to refreshIndexRules with the rules are defined in the indexing_configuration_website.xml file then throws multilines of warning

Hints

  • Magnolia SearchIndex is introduced since  MAGNOLIA-7231, MGNLCE-118. We need to use our SearchIndex to fix the fresh installation warning which was handled by MAGNOLIA-7197.
  • Our migration script for testing will need to update the SearchIndex configuration:
  •  
    #From < 5.5.9 and < 5.6.2
    if [[ $MAJOR_VER_FROM -eq 5 && ($MINOR_VER_FROM -lt 5 || (($MINOR_VER_FROM -eq 5) && $FIX_VER_FROM -le 9) || (($MINOR_VER_FROM -eq 6) && $FIX_VER_FROM -le 2) )]] ; then
    echo 'Updating to Magnolia SearchIndex...'
    perl -pi -e 's/org.apache.jackrabbit.core.query.lucene.SearchIndex/info.magnolia.jackrabbit.lucene.SearchIndex/g' $TOMCAT_DIR/webapps/magnoliaAuthor/WEB-INF/config/repo-conf/jackrabbit-bundle-derby-search.xml
    perl -pi -e 's/indexing_configuration.xml/indexing_configuration_\$\{wsp.name\}.xml/g' $TOMCAT_DIR/webapps/magnoliaAuthor/WEB-INF/config/repo-conf/jackrabbit-bundle-derby-search.xml
    fi
    
  • Node types are independence with workspaces. So that we don't need to loop over all workspaces to update the node type definition CoreModuleVersionHandler#getLockableMixinAdditionTasksForAllWorkspaces
  • Find a way to update Versionable node type (add mixin) without un-register bunch of dependent node types 


 Comments   
Comment by Mikaël Geljić [ 26/Jul/18 ]

Few options:

* Add a troubleshooting section to DOCS57, and advise to update Jackrabbit configuration files (potentially * amount of workspaces)

Problem

2018-07-25 17:48:33,691 WARN  rabbit.core.query.lucene.IndexingConfigurationImpl: Unable to refresh index rules
javax.jcr.nodetype.NoSuchNodeTypeException: {http://www.magnolia.info/jcr/mgnl}page
	at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getNodeTypeDef(NodeTypeRegistry.java:552) ~[jackrabbit-core-2.16.1.jar:2.16.1]

OR

2018-03-16 11:30:57,892 WARN  rg.apache.jackrabbit.core.query.lucene.SearchIndex: Exception initializing indexing configuration from: /info/magnolia/jackrabbit/indexing_configuration_website.xml
javax.jcr.nodetype.NoSuchNodeTypeException: {http://www.magnolia.info/jcr/mgnl}page
	at org.apache.jackrabbit.core.nodetype.NodeTypeRegistry.getNodeTypeDef(NodeTypeRegistry.java:552) ~[jackrabbit-core-2.16.1.jar:2.16.1]

Reason

Jackrabbit 2.16 introduced existence checks for node-types when refreshing indexing configurations (previously it would accept arbitrary node-type names as strings), and your project is not using Magnolia's SearchIndex implementation yet. It was first introduced for performance reasons (MAGNOLIA-7231), but since Magnolia 5.6.6+ also prevents these exceptions (MAGNOLIA-7197).

Solution

-    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+    <SearchIndex class="info.magnolia.jackrabbit.lucene.SearchIndex">

* Maybe Jackrabbit would consider fixing this on their side? File a ticket on the Jackrabbit issue tracker at https://issues.apache.org/jira/browse/JCR
Consider proposing your patch to lock/defer/retry initialization or refresh of the IndexingConfiguration when node-types are being manipulated/registered. We could enter/exit such mode with explicit calls. (check their contribution process).

Regarding your other hints:

Our migration script for testing will need to update the SearchIndex configuration:

—feel free to propose a PR, we just won't see this error anymore, but others will.

[...] we don't need to loop over all workspaces to update the node type definition

—PR welcome here too! but I don't believe it will solve this issue though.

Find a way to update Versionable node type (add mixin) without un-register bunch of dependent node types

—it's impossible to register a node type definition which references a supertype that isn't registered yet; so it's also impossible to unregister a supertype without unregistering its usages first, otherwise the repository would become inconsistent.

Generated at Mon Feb 12 04:23:01 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.