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

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

Patch looks good. I think {{LockBasedScheduler.setHead()}} should be inlined 
now.

On a somewhat related note:

* When creating the {{ChangeDispatcher}} instance in the constructor of 
{{LockBasedScheduler}} we should avoid the call to 
{{LockBasedScheduler.getHeadNodeState()}}. This is a call to an overridable 
method at construction time, which can be troublesome as the instance in not 
fully initialises yet. On top of that the default implementation might have 
side effects through its call to {{refreshHead}}. We should probably just use 
{{head.get()}} to initialise that {{ChangeDispatcher}} instance. 

* Could we remove the {{addObserver()}} method from the {{Scheduler}} interface 
and instead have {{LockBasedScheduler}} implement {{Observable}} (or not 
depending on the {{dispatchChanges}} flag in 
{{LockBasedSchedulerBuilder.build()}}. {{SegmentNodeStore.addObserver()}} would 
then instance of check the {{scheduler}} for {{Observable}}. 

> Simplify merge logic in LockBasedScheduler
> ------------------------------------------
>
>                 Key: OAK-6074
>                 URL: https://issues.apache.org/jira/browse/OAK-6074
>             Project: Jackrabbit Oak
>          Issue Type: Task
>          Components: segment-tar
>            Reporter: Andrei Dulceanu
>            Assignee: Andrei Dulceanu
>            Priority: Minor
>             Fix For: 1.8, 1.7.3
>
>         Attachments: OAK-6074.patch
>
>
> The current logic for executing a commit in {{LockBasedScheduler}} is 
> unnecessarily intricate, containing separate strategies for optimistic and 
> pessimistic merges. While these would have made sense in a hierarchical, 
> multi-journal approach, when using a single journal file we always end up on 
> the optimistic merge branch, since a commit semaphore is acquired before 
> attempting to merge the commit. The proposal is to remove 
> {{LockBasedScheduler#optimisticMerge}} and 
> {{LockBasedScheduler#pessimisticMerge}} methods, simplifying the logic inside 
> {{LockBasedScheduler#execute}}.



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

Reply via email to