jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig <mdue...@apache.org>
Subject Re: concurrent creation of users
Date Sat, 15 Mar 2014 15:02:23 GMT


On 14.3.14 11:22 , Tobias Bocanegra wrote:
> Hi,
>
> On Fri, Mar 14, 2014 at 2:43 PM, Michael Dürig <mduerig@apache.org> wrote:
>>
>>
>> On 14.3.14 1:06 , Tobias Bocanegra wrote:
>>>
>>> Hi,
>>>
>>> I tried to create users concurrently, and I get a constraint violation:
>>>
>>> "Cannot create user/group: Intermediate folders must be of type
>>> rep:AuthorizableFolder."
>>>
>>> on the "addExistingNode" parent, because the User validator traverses
>>> up the following tree:
>>>
>>>
>>> "/rep:security/rep:authorizables/rep:users/:conflict/addExistingNode/u/us/user-5"
>>
>>
>> This is already strange.
>> o.a.j.o.plugins.commit.JcrConflictHandler#JCR_CONFLICT_HANDLER should run
>> before any other hook (see o.a.j.o..jcr.Jcr#Jcr(Oak)). This conflict handler
>> replaces the :conflict markers with rep:MergeConflict markers. Later in the
>> chain of hooks o.a.j.o..plugins.commit.ConflictValidatorProvider fails the
>> commit when there are unresolved conflicts. I.e. when there are
>> rep:MergeConflict markers left.
> well, this is an oak-core test where there is no JCR. I tried adding
> the JcrConflictHandler but then I get NPEs.

Ah I see. The respective validators are missing from the test setup. But 
maybe this was done intentionally? I can't really tell. However If I add 
the and run the test I get stack traces that resemble more what I would 
expect:

org.apache.jackrabbit.oak.api.CommitFailedException: OakState0001: 
Unresolved conflicts in /rep:security/rep:authorizables/rep:users
	at 
org.apache.jackrabbit.oak.plugins.commit.ConflictValidator.failOnMergeConflict(ConflictValidator.java:84)
	at 
org.apache.jackrabbit.oak.plugins.commit.ConflictValidator.propertyAdded(ConflictValidator.java:54)
	at 
org.apache.jackrabbit.oak.spi.commit.CompositeEditor.propertyAdded(CompositeEditor.java:83)
	at 
org.apache.jackrabbit.oak.spi.commit.EditorDiff.propertyAdded(EditorDiff.java:82)
	at 
org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:375)
	at 
org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)
	at 
org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:396)
	at 
org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)
	at 
org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:396)
	at 
org.apache.jackrabbit.oak.spi.commit.EditorDiff.childNodeChanged(EditorDiff.java:148)
	at 
org.apache.jackrabbit.oak.plugins.memory.ModifiedNodeState.compareAgainstBaseState(ModifiedNodeState.java:396)
	at 
org.apache.jackrabbit.oak.spi.commit.EditorDiff.process(EditorDiff.java:52)
	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.memory.MemoryNodeStore$MemoryNodeStoreBranch.merge(MemoryNodeStore.java:217)
	at 
org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore.merge(MemoryNodeStore.java:96)
	at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:242)
	at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:253)
	at 
org.apache.jackrabbit.oak.security.user.UserManagerImplTest$1.run(UserManagerImplTest.java:267)


Here is what I did:

@@ -81,12 +83,14 @@
      public void before() throws Exception {
          Oak oak = new Oak()
                  .with(new InitialContent())
+                .with(JcrConflictHandler.JCR_CONFLICT_HANDLER)
                  .with(new NamespaceEditorProvider())
                  .with(new ReferenceEditorProvider())
                  .with(new ReferenceIndexProvider())
                  .with(new PropertyIndexEditorProvider())
                  .with(new PropertyIndexProvider())
                  .with(new TypeEditorProvider())
+                .with(new ConflictValidatorProvider())
                  .with(getSecurityProvider());
          withEditors(oak);
          contentRepository = oak.createContentRepository();


Michael


>
>
>>> How should this work? should the user validator stop on the
>>> ":conflict" node? btw: there is never a real conflict here. all nodes
>>> are the same.
>>
>>
>> I vaguely remember that we might have though this to be too expensive, but I
>> might be wrong.
>> The AbstractRebaseDiff (which is the in memory version for conflict
>> handling) certainly behaves as Toby describes. Jukka, Marcel what about the
>> respective node store implementations? We might even have different
>> behaviours here depending on who does the diffing.
>>
>
> regards, toby
>

Mime
View raw message