You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Joerg Hoh (Jira)" <ji...@apache.org> on 2025/07/28 09:36:00 UTC

[jira] [Resolved] (OAK-11784) new instance of NamespaceRegistry is created whenever an item is added via XML DocViewImporter

     [ https://issues.apache.org/jira/browse/OAK-11784?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joerg Hoh resolved OAK-11784.
-----------------------------
      Assignee: Joerg Hoh  (was: Manfred Baedke)
    Resolution: Fixed

> new instance of NamespaceRegistry is created whenever an item is added via XML DocViewImporter
> ----------------------------------------------------------------------------------------------
>
>                 Key: OAK-11784
>                 URL: https://issues.apache.org/jira/browse/OAK-11784
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: jcr
>    Affects Versions: 1.78.0
>            Reporter: Joerg Hoh
>            Assignee: Joerg Hoh
>            Priority: Major
>
> While tracing slow package imports via filevault, I came across this stacktrace, which appears quite often (around 12% of the times):
> {noformat}
>         [...]
> 	at org.apache.jackrabbit.oak.plugins.name.ReadOnlyNamespaceRegistry.<init>(ReadOnlyNamespaceRegistry.java:60)
> 	at org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry.<init>(ReadWriteNamespaceRegistry.java:42)
> 	at org.apache.jackrabbit.oak.jcr.session.WorkspaceImpl$4.<init>(WorkspaceImpl.java:223)
> 	at org.apache.jackrabbit.oak.jcr.session.WorkspaceImpl.getNamespaceRegistry(WorkspaceImpl.java:223)
> 	at org.apache.jackrabbit.commons.NamespaceHelper.registerNamespace(NamespaceHelper.java:196)
> 	at org.apache.jackrabbit.oak.jcr.xml.ImportHandler.startPrefixMapping(ImportHandler.java:139)
> 	at org.apache.jackrabbit.vault.fs.impl.io.DocViewImporter.createNewNode(DocViewImporter.java:1117)
>         [...]
> {noformat}
> Whenever the NamespaceRegistry is created it reads the namespace tree from the repository, which is expensive operation, especially when called in a tight loop as the {{ImportHandler.startElement()}}.
> For that the ImportHandler should be able to create the NamespaceRegistry on its own and then reuse it (instead of letting the {{NamespaceHelper.registerNamespace()}} re-create it on every invocation.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)