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.
- depends on
-
NXP-14964 Fix page provider using CoreSession #queryAndFetch max page size to 0
- Resolved
-
NXP-14947 Allow unrestricted queries on document page providers
- Resolved
-
NXP-14957 Allow specifying language to queryAndFetch page provider
- Resolved
- is required by
-
NXP-14895 Enable DocumentRoutingEscalationServiceImpl.queryForSuspendedNodesWithEscalation query alternative
- Open