[ 
https://issues.apache.org/jira/browse/OAK-5511?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15980804#comment-15980804
 ] 

Chetan Mehrotra commented on OAK-5511:
--------------------------------------

bq. Using the node type index is an interesting idea. That basically means the 
child node lookup would be replaced with a query.

This would not do a query but instead use a cached in memory state which is 
build up from the nodetype index state. The cached state would be kept upto 
date via observer. In cached state we just need to know those parent path which 
have oak:index. This should not be large in number. We can avoid the hardcoding 
(to an extent) and check for any index under /oak:index which has 
declaringNodeType  for oak:QueryIndexDefinition. Just that it needs to be a 
property index

bq. Before looking into such options, I would like to better understand what 
exactly happens during an index update. Why do we see those remote calls when 
the update is based on a known state? Shouldn't all those checks for index 
child nodes be served from the cache?

The code is like below
{code}
    @Override
    public void enter(NodeState before, NodeState after)
            throws CommitFailedException {
        collectIndexEditors(builder.getChildNode(INDEX_DEFINITIONS_NAME), 
before);
{code}

If the calling code has not done any traversal on child but instead just looked 
up for child then in those cases the child info would not be cached and hence 
an explicit lookup for oak:index does a remote call. And this is done at each 
changed node both at time of commit and also during async index update



> Reduce lookup for oak:index node under each changed node
> --------------------------------------------------------
>
>                 Key: OAK-5511
>                 URL: https://issues.apache.org/jira/browse/OAK-5511
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: indexing
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>              Labels: performance
>             Fix For: 1.8
>
>
> Currently {{IndexUpdate}} does a lookup for {{oak:index}} node under each 
> changed node. This is done to pickup index definitions and create IndexEditor 
> based on those so as to index content under that subtree. 
> This lookup results in extra remote calls on DocumentNodeStore based setup as 
> for non leaf nodes NodeStore has to check from remote storage to determine if 
> {{oak:index}} node is present or not.
> This lookup can be avoided by
> # Having an {{Editor}} which adds a hidden property {{:oak-index-present}} in 
> parent node upon addition of {{oak:index}} as a child node
> # IndexUpdate would then does a lookup for {{oak:index}} node only if such a 
> hidden property is found
> For upgrade we would have some logic which would make use of Nodetype index 
> to identify all such nodes and mark them
> Discussion 
> [thread|https://lists.apache.org/thread.html/70d5ffff0f950d7fc25bc1bbb41527f5672825f8cf2b238f54df2966@%3Coak-dev.jackrabbit.apache.org%3E]
>  on oak-dev



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to