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

Tomek Rękawek commented on OAK-7710:
------------------------------------

Hi Vikas,

bq. Tomek Rękawek, afaiu, now locally observed events would be dispatched 
essentially from inside globalStore#merge. There's a good chunk of code (which, 
admittedly, I don't quite grasp) beyond globalStore#merge in merge method [0] 

Yes, this code is mainly related to the commit hooks handling and the trying to 
"extract" the part of the passed CompositeNodeBuilder which should be really 
merged to the global store.

For the descriptions below, let's assume we have a setup with a single 
read-only mount: {{/apps}}.

bq. the dispatched, afaiu, refers to new 'global'NodeState but still old states 
from other stores (which would be ok afaict - those being read-only)...

Yes, it's similar to how other methods in the CompositeNodeStore works. Every 
time we need to return the root node state, we create this CompositeNodeState, 
that is composed from the root on the global store and all the partials. It's 
similar for the {{getRoot()}}, {{merge()}}, {{retrieveCheckpoint()}}, etc.

For the observer implementation, we have the new root node state of the global 
store, we combine it together with the roots of the partial stores (as you 
noticed they're read-only) and pass it to observer. This way, the observer have 
access not only to the recently-updated content in the global root, but also 
the mounted stores (eg. they can read the {{/apps}}).

bq. but there's that hookEnhancer thing (which I've no idea about).

The hook enhancer is specific for the merge logic. When the globalStore.merge() 
is invoked, it executed all the commit hooks on its own. The commit hook 
objects may try to read content from the mounts (eg. a hook may request the 
{{/apps}}). In order to provide this mounted content to the hooks, running 
inside the globalStore.merge() method, we introduced the hook enhancers.

Since the observers are called after the hooks are already finished and the 
content is already merged, we don't need to use them in the observer proxy.

> CompositeNodeStore does not dispatch external events to observers
> -----------------------------------------------------------------
>
>                 Key: OAK-7710
>                 URL: https://issues.apache.org/jira/browse/OAK-7710
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: composite
>            Reporter: Vikas Saurabh
>            Assignee: Tomek Rękawek
>            Priority: Major
>             Fix For: 1.10, 1.9.9
>
>         Attachments: OAK-7710-2.patch, OAK-7710-3.patch, OAK-7710.patch, 
> OAK-7710.test.patch
>
>
> Currently {{CompositeNodeStore}} only ever dispatches changes from inside its 
> {{merge}} method. This then loses external events that could be read in 
> background read of some underlying {{DocumentNodeStore}}.
> [^OAK-7710.test.patch] has an ignored test representing the scenario.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to