Hi,

the scope of the merge lock is on a single cluster
node only. in general the DocumentNodeStore first
tries to merge a change optimistically, holding a
shared merge lock. at some point it will acquire an
exclusive merge lock, which effectively serializes
merges on a single cluster node. however, this does
not guarantee that there are no conflicts introduced
by commit editors running on other cluster nodes. we
decided against a global lock because it would be too
expensive in a geo-distributed setup. instead, the
DocumentNodeStore will fail the commit after a number
of retries to guarantee progress.

as mentioned above, on a single DocumentNodeStore instance
the merge lock guarantees conflicts introduced by
commit editors can be resolved / retried. E.g. one of
your tests creates nodes under a given parent node.
the parent has orderable child nodes and results in
conflicts on the ordering of the added child nodes. this
works fine when you run the test on a single instance
only. See [0], but may fail in a cluster like in your
test. To avoid this kind of conflicts it is recommended
to use a node type for the parent without orderable
child nodes. E.g. you can try it with oak:Unstructured.

Regards
 Marcel

[0] 
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-jcr/src/test/java/o
rg/apache/jackrabbit/oak/jcr/ConcurrentAddIT.java#L83

On 09/03/16 14:21, "Dominik Förderreuther" wrote:

>Hi Marcel, 
>
>thank you for your answer.
>
>Replication latency was not part of my test. I’m worrying about the
>concurrent write attempts despite the write lock of the merging process.
>Any ideas regarding this observed behaviour?
>
>Cheers!
>Dominik
>
>--  
>Dominik Förderreuther  |  Senior Consultant  |  Adobe Systems GmbH  |
>+49.89.31705.488 (office)  |  +49.172.8082132 (mobile)  |  [email protected]
>
>
>
>
>
>
>On 09/03/16 09:07, "Marcel Reutegger" <[email protected]> wrote:
>
>>Hi Dominik,
>>
>>an Oak cluster on MongoDB does not provide strong
>>consistency guarantees. The same is actually true for
>>all DocumentNodeStore cluster setups, independent of the
>>DocumentStore backend. A write on one cluster node
>>will not be visible immediately on other cluster nodes.
>>The change will eventually show up, but depends on the
>>timing of background operations running. There are
>>existing tests like ClusterTest [0], which check this
>>behaviour.
>>
>>If you still think changes are not properly propagated
>>through the cluster, then please create a test in oak-core
>>using existing utilities. Oak currently does not start
>>up its own MongoDB during tests, but rather depends on
>>a running instance.
>>
>>Regards
>> Marcel 
>>
>>[0] 
>>https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.4.0/oak-co
>>re
>>/src/test/java/org/apache/jackrabbit/oak/plugins/document/ClusterTest.jav
>>a
>>
>>On 08/03/16 17:22, "Dominik Förderreuther" wrote:
>>
>>>Hi,
>>>
>>>we have merge conflicts in our cluster environment. I could reproduce
>>>[1,
>>>2] merge conflicts in an integration test with an embedded MongoDB and
>>>two clustered repositories. I have already created a pull request [3]
>>>for
>>>the test-module. Would be great if you could give me some comments
>>>regarding the sense of meaning of my test setup and the experienced
>>>exception.
>>>
>>>At the moment, I assume there is a problem with the write lock within
>>>org.apache.jackrabbit.oak.spi.state.AbstractNodeStoreBranch.BranchState#
>>>me
>>>rge and concurrent cluster replication activity, but I¹m not done with
>>>debugging. I¹ll also merge the integration test into trunk within the
>>>next days.
>>>
>>>Thanks and best regards,
>>>Dominik
>>>
>>>[1] Repository: 
>>>https://github.com/dfoerderreuther/jackrabbit-oak/<https://github.com/df
>>>oe
>>>rderreuther/jackrabbit-oak/tree/1.0/oak-it/cluster> respectively:
>>>https://github.com/dfoerderreuther/jackrabbit-oak/tree/1.0/oak-it/cluste
>>>r
>>>[2] Example Test-Report:
>>>https://github.com/dfoerderreuther/jackrabbit-oak/blob/1.0/oak-it/cluste
>>>r/
>>>reports/2REPOS_50THREADS.md
>>>[3] Pull-Request: https://github.com/apache/jackrabbit-oak/pull/51
>>>
>>>
>>>
>>>--
>>>
>>>Dominik Förderreuther  |  Senior Consultant  |  Adobe Systems GmbH  |
>>>+49.89.31705.488 (office)  |  +49.172.8082132 (mobile)  |  [email protected]
>>

Reply via email to