Hi Raffaele

It may be worth taking a look at the conflict handling built into the
oak-store-spi. This is an internal API, i.e. a lot lower down than the
JCR API. Disclaimer: I don't know it well :) An example is
org.apache.jackrabbit.oak.plugins.commit.JcrLastModifiedConflictHandler,
and other classes that are involved AFAIK are
org.apache.jackrabbit.oak.spi.state.ConflictAnnotatingRebaseDiff,
org.apache.jackrabbit.oak.plugins.commit.MergingNodeStateDiff
andorg.apache.jackrabbit.oak.spi.commit.ThreeWayConflictHandler.

Not sure if you need to configure something in particular during
repository construction.

Hope this helps.

Regards
Julian

On Tue, 9 Dec 2025 at 15:01, Konrad Windszus <[email protected]> wrote:
>
> Compare also with 
> https://jackrabbit.apache.org/oak/docs/dos_and_donts.html#Avoid_or_minimize_conflicts
> Konrad
>
> > On 9. Dec 2025, at 14:32, Jörg Hoh <[email protected]> wrote:
> >
> > Hi Raffaele,
> >
> > Oak uses the MVCC pattern, in Jackrabbit 2.x this does not exist. For that
> > any write conflicts must be resolved, and if they cannot be auto-resolved,
> > they will throw an exception (like in your case).
> >
> > In my experience the best approach is to clearly split the
> > responsibilities, that you don't have concurrent writes on the same nodes.
> > The second best is to design the content structure in a way, that you don't
> > have frequent conflicting writes. And the last option is to implement a
> > retry...
> >
> > Jörg
> >
> >
> >
> > Am Di., 9. Dez. 2025 um 12:59 Uhr schrieb Raffaele Gambelli via oak-dev <
> > [email protected]>:
> >
> >> Hello everyone,
> >> With the aim of replacing Jackrabbit with Oak, I am continuing with the
> >> checks.
> >> While performing load tests to simulate concurrency, I encountered this
> >> exception:
> >> Caused by: javax.jcr.InvalidItemStateException: OakState0001: Unresolved
> >> conflicts in /containers/Cartella Protocolli Incompleti/2025/12/9
> >> at
> >> org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:238)
> >> at
> >> org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:213)
> >> at
> >> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryException(SessionDelegate.java:745)
> >> at
> >> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:559)
> >> at
> >> org.apache.jackrabbit.oak.jcr.session.SessionImpl$9.performVoid(SessionImpl.java:460)
> >> at
> >> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(SessionDelegate.java:306)
> >> at
> >> org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:457)
> >> at
> >> it.cbt.wr.core.WorkSessionApplicationImpl.sessionSave(WorkSessionApplicationImpl.java:3808)
> >> at
> >> it.cbt.wr.core.WorkSessionApplicationImpl.save(WorkSessionApplicationImpl.java:1341)
> >> ... 180 more
> >> Caused by: org.apache.jackrabbit.oak.api.CommitFailedException:
> >> OakState0001: Unresolved conflicts in /containers/Cartella Protocolli
> >> Incompleti/2025/12/9
> >> at
> >> org.apache.jackrabbit.oak.plugins.commit.ConflictValidator.failOnMergeConflict(ConflictValidator.java:113)
> >> at
> >> org.apache.jackrabbit.oak.plugins.commit.ConflictValidator.propertyAdded(ConflictValidator.java:82)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.CompositeEditor.propertyAdded(CompositeEditor.java:76)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.EditorDiff.propertyAdded(EditorDiff.java:81)
> >> at
> >> org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:377)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147)
> >> at
> >> org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:399)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147)
> >> at
> >> org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:399)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147)
> >> at
> >> org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:399)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147)
> >> at
> >> org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:399)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:147)
> >> at
> >> org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:399)
> >> at
> >> org.apache.jackrabbit.oak.plugins.document.ModifiedDocumentNodeState.compareAgainstBaseState(ModifiedDocumentNodeState.java:132)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:51)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.EditorHook.processCommit(EditorHook.java:54)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:60)
> >> at
> >> org.apache.jackrabbit.oak.spi.commit.CompositeHook.processCommit(CompositeHook.java:60)
> >> at
> >> org.apache.jackrabbit.oak.plugins.document.TimingHook.processCommit(TimingHook.java:59)
> >> at
> >> org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$InMemory.merge(DocumentNodeStoreBranch.java:548)
> >> at
> >> org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge0(DocumentNodeStoreBranch.java:203)
> >> at
> >> org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge(DocumentNodeStoreBranch.java:122)
> >> at
> >> org.apache.jackrabbit.oak.plugins.document.DocumentRootBuilder.merge(DocumentRootBuilder.java:170)
> >> at
> >> org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.merge(DocumentNodeStore.java:2155)
> >> at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:261)
> >> at
> >> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.commit(SessionDelegate.java:402)
> >> at
> >> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegate.java:557)
> >> ... 185 more
> >>
> >>
> >> In that specific case, I had three users creating the same node, within
> >> the same path and at approximately the same time.
> >> In my code, all I do is save the session.
> >> I would like to point out that the same code does not cause this type of
> >> problem with Jackrabbit.
> >> Are there any specific recommendations for managing competition in oak?
> >> Thanks for your help
> >>
> >>
> >> Cordiali saluti / Best regards,
> >>
> >> Raffaele Gambelli
> >> Application Architect
> >> E  [email protected]<mailto:[email protected]>
> >> M +39 3371641888
> >> [
> >> https://images.eu.signature365.com/b2uknhefs98nwdub/img_USamABop1MkXu35s/v114.jpg
> >> ]
> >> [CEGEKA]
> >> Via Ettore Cristoni, 84
> >> IT-40033 Bologna (IT), Italy
> >> T +39 02 2544271
> >> WWW.CEGEKA.COM<https://www.cegeka.com>
> >>
> >>
> >>
> >>
> >>
> >
> > --
> > https://cqdump.joerghoh.de
>

Reply via email to