Netcentric / accesscontroltool

Rights and roles management for AEM made easy
Eclipse Public License 1.0
147 stars 92 forks source link

Invalid index detection in the cloud #730

Closed ghenzler closed 3 weeks ago

ghenzler commented 4 weeks ago

For the automatic index detection from #714, it turns out that locally the cost is returned as cost: { "s": 189540.0 } but in the cloud as cost: { "s": { perEntry: 1.0, perExecution: 1.0, count: 47814 } } this seems to stem from https://github.com/apache/jackrabbit-oak/blob/5d10c51ff53dc05e2d36b2491689412ccd17b15d/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java#L448C34-L448C52

I'm not sure why the index is only a AdvancedQueryIndex in the cloud, to be checked.

The reason why the impl of #714 does not throw an exception is that https://www.javadoc.io/doc/com.fasterxml.jackson.core/jackson-databind/2.8.5/com/fasterxml/jackson/databind/JsonNode.html#asDouble(double) never throws an exception but always just returns the default if a double cannot be coerced (even for a map instead of a skalar)

ghenzler commented 4 weeks ago

After some more testing I also get the "three entry map" in AEM 6.5, that is e.g.

def checkIndexExplainQuery = "explain measure SELECT * FROM [rep:ACL] AS s WHERE ISDESCENDANTNODE([/])";
def query = session.getWorkspace().getQueryManager().createQuery(checkIndexExplainQuery, javax.jcr.query.Query.JCR_SQL2);
println query.execute().getRows().nextRow().getValues()[0]

returns

[rep:ACL] as [s] /* lucene:repACL-custom-1(/oak:index/repACL-custom-1) jcr:primaryType:rep:ACL where isdescendantnode([s], [/]) */ cost: { "s": { perEntry: 1.0, perExecution: 1.0, count: 882 } }

on AEM 6.5 SP 20 (oak 1.22.18)