Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-14893

Enable TagServiceImpl.UnrestrictedGetDocumentTags.run query alternative

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.8.0-HF18, 5.9.4
    • Fix Version/s: 6.0
    • Component/s: Tagging

      Description

      The UnrestrictedGetDocumentTags.run uses an hard coded NXQL query that sometime does not scale.
      Using a page provider will enable to override the query, so we can use Elasticsearch if available to query tasks.

      The slow-query.log says:

      2014-07-29 07:42:13,005 INFO  [Nuxeo-Work-elasticSearchIndexing-4][org.nuxeo.ecm.core.storage.sql.SessionImpl] duration_ms:	170.96	QueryFilter(principal=system, limit=0, offset=0)	queryAndFetch	TAGISTARGET: SELECT DISTINCT tag:label FROM Tagging WHERE relation:source = '7d80e463-bd23-4a25-a1f3-f43cdb97df48'{}
      java.lang.Throwable: Slow query stack trace
      	at org.nuxeo.ecm.core.storage.sql.SessionImpl.queryAndFetch(SessionImpl.java:1295)
      	at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.queryAndFetch(ConnectionImpl.java:375)
      	at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession$SQLSessionQuery.executeAndFetch(SQLSession.java:629)
      	at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.queryAndFetch(SQLSession.java:546)
      	at org.nuxeo.ecm.core.api.AbstractSession.queryAndFetch(AbstractSession.java:1676)
      	at org.nuxeo.ecm.platform.tag.TagServiceImpl$UnrestrictedGetDocumentTags.run(TagServiceImpl.java:316)
      	at org.nuxeo.ecm.core.api.UnrestrictedSessionRunner.runUnrestricted(UnrestrictedSessionRunner.java:115)
      	at org.nuxeo.ecm.platform.tag.TagServiceImpl.getDocumentTags(TagServiceImpl.java:285)
      	at org.nuxeo.ecm.automation.jaxrs.io.documents.JsonESDocumentWriter.writeDoc(JsonESDocumentWriter.java:80)
      	at org.nuxeo.ecm.automation.jaxrs.io.documents.JsonESDocumentWriter.writeESDocument(JsonESDocumentWriter.java:146)
      	at org.nuxeo.elasticsearch.ElasticSearchComponent.buildEsIndexingRequest(ElasticSearchComponent.java:440)
      	at org.nuxeo.elasticsearch.ElasticSearchComponent.processIndexCommand(ElasticSearchComponent.java:347)
      	at org.nuxeo.elasticsearch.ElasticSearchComponent.indexNow(ElasticSearchComponent.java:334)
      	at org.nuxeo.elasticsearch.work.ChildrenIndexingWorker.doIndexingWork(ChildrenIndexingWorker.java:65)
      	at org.nuxeo.elasticsearch.work.AbstractIndexingWorker.work(AbstractIndexingWorker.java:65)
      	at org.nuxeo.ecm.core.work.WorkHolder.run(WorkHolder.java:66)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:744)
      

      But this is a query and fetch.

      Note also that query visible in this stack trace should still point to the core in this case, since this is ES trying to index tags already set in the core => a new API is needed to specify whether tags should be retrieved using the core (e.g not optimised) or not.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 4 hours
                  4h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified