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

Michael Dürig commented on OAK-1838:
------------------------------------

I implemented something log the lines of point 1 above in my private [Github 
branch|https://github.com/mduerig/jackrabbit-oak/tree/OAK-1838]. 
{{NodeStore.merge}} and {{NodeStoreBranch.merge}} now take and 
{{EditorProvider}} instead of a {{CommitHook}}. To cover for raw 
{{CommitHooks}} I added {{HookEditor}}, which wraps the former into into an 
{{Editor}}. This approach allows me to pass a {{NodeBuilder}} directly into the 
{{EditorProvider}} so that one will be used during pre commit processing 
instead of a new one acquires from the after state of the {{CommitHook}}. 
Finally I replaced the "thread local like" approach in the document node store 
to pass the current branch around with passing it explicitly with this new 
mechanism.

With these changes (integration)test pass except for 
{{RepositoryGroupMemberUpgradeTest#verifyMemberOf}}, which needs further 
investigation. 

The advantage of this approach is that we now can document the memory 
limitation of the node builders passed to client code, while previously this 
was pretty much implied. More concretely this means node builders are generally 
not save for a lot of changes unless the one passed through the 
{{EditorProvider}}. 

Overall I don't like this approach very much. While it is a slight improvement 
to the current situation it seems to complex and too fragile. Passing all that 
state around (i.e. ({{NodeBuilder}}) instead of relying on the pure (i.e. 
stateless) {{CommitHook.processCommit}} function complicates things too much 
IMO. 

I very much would like to see an effort into point 2 from above so we could 
weight pros and cons of both approaches against each other. 

[~mreutegg], [~jukkaz], review and comments appreciated. 

> NodeStore API: divergence in contract and implementations
> ---------------------------------------------------------
>
>                 Key: OAK-1838
>                 URL: https://issues.apache.org/jira/browse/OAK-1838
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>            Reporter: Michael Dürig
>
> Currently there is a gap between what the API mandates and what the document 
> and kernel node stores implement. This hinders further evolution of the Oak 
> stack as implementers must always be aware of non explicit design 
> requirements. We should look into ways we could close this gap by bringing 
> implementation and specification closer towards each other. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to