You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Robert Munteanu <ro...@apache.org> on 2016/09/01 07:36:46 UTC

Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Hi,

I'm working on implementing a custom node store which multiplexes other
node stores.

Adding it as a fixture in oak-it results in a test failure in�

� ReadWriteNamespaceRegistryTest.testMappings [1]

The reason is
that�org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent
class wraps the passed nodeStore into a MemoryNodeStore, and that
memory node store later on receives a builder which is not
MemoryNodeBuilder [2] \u2192 IllegalArgumentException.

I'm not familiar enough with that class to propose a fix, but
effectively it forces all builders to be MemoryNodeBuilders, which is
too restrictive IMO.

Is this a bug to file or something that I need to live with when
implementing a new NodeStore?

Thanks,

Robert


[1]:�https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e0ffb
085e07642ffa44d8c7ca/oak-
it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamesp
aceRegistryTest.java#L46
[2]:�https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e0ffb
085e07642ffa44d8c7ca/oak-
core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/Ini
tialContent.java#L119

Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Robert Munteanu <ro...@apache.org>.
Noted, thanks!

Robert

On Thu, 2016-09-01 at 15:55 +0200, Michael D�rig wrote:
> See https://issues.apache.org/jira/browse/OAK-4741
> 
> On 1.9.16 3:44 , Michael D�rig wrote:
> > 
> > 
> > The reason for this is that MemoryNodeStore requires as
> > MemoryNodeState
> > passed to its constructor. Apparently this is not the case here:
> > 
> > > 
> > > ��������NodeState base =
> > > ModifiedNodeState.squeeze(builder.getNodeState());
> > > ��������NodeStore store = new MemoryNodeStore(base);
> > > ��������NodeTypeRegistry.registerBuiltIn(RootFactory.createSystem
> > > Root(
> > > ����������������store, new EditorHook(new
> > > CompositeEditorProvider(
> > > ����������������new NamespaceEditorProvider(),
> > > ����������������new TypeEditorProvider())), null, null, null,
> > > null));
> > 
> > This is not documented nor does that constructor have the right
> > signature. This is a bug and I'll file an issue for it once I come
> > around to it.
> > 
> > Michael
> > 
> > On 1.9.16 2:37 , Robert Munteanu wrote:
> > > 
> > > On Thu, 2016-09-01 at 12:19 +0200, Michael D�rig wrote:
> > > > 
> > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > I have a failing test in my fork at
> > > > > 
> > > > > � https://github.com/rombert/jackrabbit-oak/
> > > > > 
> > > > > If I run ReadWriteNamespaceRegistryTest from Eclipse it picks
> > > > > up
> > > > > all
> > > > > fixtures - including the Multiplexing one I added - and fails
> > > > > with
> > > > > that
> > > > > one.
> > > > > 
> > > > > Getting this isolated would be hard since it requires a full
> > > > > NodeStore
> > > > > implementation whose NodeState and NodeBuilder
> > > > > implementations
> > > > > don't
> > > > > extend the memory-based ones.
> > > > 
> > > > Can you share the stack trace of the failing test? Or is this
> > > > not
> > > > helpful as there are too many modifications of Oak's core parts
> > > > in
> > > > your
> > > > fork? Otherwise please share and indicate which revision of Oak
> > > > this
> > > > fork is based on.
> > > 
> > > I've pasted the stack trace at the end.
> > > 
> > > As for my changes I have not touched the core parts of oak, the
> > > 'java'
> > > part is contained in plugins/multiplex and spi/mount . I've
> > > recently
> > > merged trunk up to r1758729.
> > > 
> > > I am wondering whether the InitialContent wraps the NodeState in
> > > a new
> > > NodeStore only because it does not have access to the originating
> > > NodeStore. That would give an indication of a possible solution.
> > > 
> > > Robert
> > > 
> > > ReadWriteNamespaceRegistryTest.testMappings
> > > org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry
> > > Test
> > > [MultiplexingSegmentFixture with a mount under /tmp]
> > > testMappings[MultiplexingSegmentFixture with a mount under
> > > /tmp](org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRe
> > > gistry
> > > Test)
> > > java.lang.IllegalArgumentException
> > > ����at
> > > com.google.common.base.Preconditions.checkArgument(Preconditions.
> > > java:7
> > > 7)
> > > ����at
> > > org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore.merge(Me
> > > moryNo
> > > deStore.java:126)
> > > ����at
> > > org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.jav
> > > a:249)
> > > ����at
> > > org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:
> > > 35)
> > > ����at
> > > org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.jav
> > > a:260)
> > > ����at
> > > org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:
> > > 35)
> > > ����at
> > > org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry
> > > .regis
> > > terNamespace(ReadWriteNamespaceRegistry.java:94)
> > > ����at
> > > org.apache.jackrabbit.commons.cnd.TemplateBuilderFactory.setNames
> > > pace(T
> > > emplateBuilderFactory.java:92)
> > > ����at
> > > org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.doName
> > > Space(
> > > CompactNodeTypeDefReader.java:246)
> > > ����at
> > > org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.parse(
> > > Compac
> > > tNodeTypeDefReader.java:200)
> > > ����at
> > > org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>
> > > (Compa
> > > ctNodeTypeDefReader.java:163)
> > > ����at
> > > org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>
> > > (Compa
> > > ctNodeTypeDefReader.java:139)
> > > ����at
> > > org.apache.jackrabbit.commons.cnd.CndImporter.registerNodeTypes(C
> > > ndImpo
> > > rter.java:147)
> > > ����at
> > > org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry
> > > .regis
> > > terNodeTypes(NodeTypeRegistry.java:109)
> > > ����at
> > > org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry
> > > .regis
> > > ter(NodeTypeRegistry.java:104)
> > > ����at
> > > org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry
> > > .regis
> > > terBuiltIn(NodeTypeRegistry.java:86)
> > > ����at
> > > org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.i
> > > nitial
> > > ize(InitialContent.java:120)
> > > ����at
> > > org.apache.jackrabbit.oak.spi.lifecycle.CompositeInitializer.init
> > > ialize
> > > (CompositeInitializer.java:48)
> > > ����at
> > > org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize
> > > (OakIn
> > > itializer.java:42)
> > > ����at
> > > org.apache.jackrabbit.oak.Oak.createNewContentRepository(Oak.java
> > > :635)
> > > ����at
> > > org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:62
> > > 3)
> > > ����at
> > > org.apache.jackrabbit.oak.Oak.createContentSession(Oak.java:737)
> > > ����at
> > > org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry
> > > Test.c
> > > reateContentSession(ReadWriteNamespaceRegistryTest.java:42)
> > > ����at
> > > org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry
> > > Test.t
> > > estMappings(ReadWriteNamespaceRegistryTest.java:47)
> > > ����at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > > ����at
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorI
> > > mpl.ja
> > > va:57)
> > > ����at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA
> > > ccesso
> > > rImpl.java:43)
> > > ����at java.lang.reflect.Method.invoke(Method.java:606)
> > > ����at
> > > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(Frame
> > > workMe
> > > thod.java:50)
> > > ����at
> > > org.junit.internal.runners.model.ReflectiveCallable.run(Reflectiv
> > > eCalla
> > > ble.java:12)
> > > ����at
> > > org.junit.runners.model.FrameworkMethod.invokeExplosively(Framewo
> > > rkMeth
> > > od.java:47)
> > > ����at
> > > org.junit.internal.runners.statements.InvokeMethod.evaluate(Invok
> > > eMetho
> > > d.java:17)
> > > ����at
> > > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfter
> > > s.java
> > > :27)
> > > ����at
> > > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> > > ����at
> > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Clas
> > > sRunne
> > > r.java:78)
> > > ����at
> > > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4Clas
> > > sRunne
> > > r.java:57)
> > > ����at
> > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> > > ����at
> > > org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> > > ����at
> > > org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> > > ����at
> > > org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> > > ����at
> > > org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> > > ����at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> > > ����at org.junit.runners.Suite.runChild(Suite.java:128)
> > > ����at org.junit.runners.Suite.runChild(Suite.java:27)
> > > ����at
> > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> > > ����at
> > > org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> > > ����at
> > > org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> > > ����at
> > > org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> > > ����at
> > > org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> > > ����at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> > > ����at
> > > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JU
> > > nit4Te
> > > stReference.java:86)
> > > ����at
> > > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecu
> > > tion.j
> > > ava:38)
> > > ����at
> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(R
> > > emoteT
> > > estRunner.java:459)
> > > ����at
> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(R
> > > emoteT
> > > estRunner.java:678)
> > > ����at
> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(Remote
> > > TestRu
> > > nner.java:382)
> > > ����at
> > > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(Remot
> > > eTestR
> > > unner.java:192)
> > > 
> > > > 
> > > > 
> > > > Michaelo
> > > > 
> > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Thanks,
> > > > > 
> > > > > Robert
> > > > > 
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > Michael
> > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > 
> > > > > > > Robert
> > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Michael
> > > > > > > > 
> > > > > > > > 
> > > > > > > > On 1.9.16 9:36 , Robert Munteanu wrote:
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > Hi,
> > > > > > > > > 
> > > > > > > > > I'm working on implementing a custom node store which
> > > > > > > > > multiplexes
> > > > > > > > > other
> > > > > > > > > node stores.
> > > > > > > > > 
> > > > > > > > > Adding it as a fixture in oak-it results in a test
> > > > > > > > > failure
> > > > > > > > > in
> > > > > > > > > 
> > > > > > > > > � ReadWriteNamespaceRegistryTest.testMappings [1]
> > > > > > > > > 
> > > > > > > > > The reason is
> > > > > > > > > that
> > > > > > > > > org.apache.jackrabbit.oak.plugins.nodetype.write.Init
> > > > > > > > > ialCon
> > > > > > > > > tent
> > > > > > > > > class wraps the passed nodeStore into a
> > > > > > > > > MemoryNodeStore,
> > > > > > > > > and
> > > > > > > > > that
> > > > > > > > > memory node store later on receives a builder which
> > > > > > > > > is not
> > > > > > > > > MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
> > > > > > > > > 
> > > > > > > > > I'm not familiar enough with that class to propose a
> > > > > > > > > fix,
> > > > > > > > > but
> > > > > > > > > effectively it forces all builders to be
> > > > > > > > > MemoryNodeBuilders,
> > > > > > > > > which
> > > > > > > > > is
> > > > > > > > > too restrictive IMO.
> > > > > > > > > 
> > > > > > > > > Is this a bug to file or something that I need to
> > > > > > > > > live with
> > > > > > > > > when
> > > > > > > > > implementing a new NodeStore?
> > > > > > > > > 
> > > > > > > > > Thanks,
> > > > > > > > > 
> > > > > > > > > Robert
> > > > > > > > > 
> > > > > > > > > 
> > > > > > > > > [1]: https://github.com/apache/jackrabbit-oak/blob/64
> > > > > > > > > f48874
> > > > > > > > > ac4a
> > > > > > > > > ab6e
> > > > > > > > > 0ffb
> > > > > > > > > 085e07642ffa44d8c7ca/oak-
> > > > > > > > > it/src/test/java/org/apache/jackrabbit/oak/plugins/na
> > > > > > > > > me/Rea
> > > > > > > > > dWri
> > > > > > > > > teNa
> > > > > > > > > mesp
> > > > > > > > > aceRegistryTest.java#L46
> > > > > > > > > [2]: https://github.com/apache/jackrabbit-oak/blob/64
> > > > > > > > > f48874
> > > > > > > > > ac4a
> > > > > > > > > ab6e
> > > > > > > > > 0ffb
> > > > > > > > > 085e07642ffa44d8c7ca/oak-
> > > > > > > > > core/src/main/java/org/apache/jackrabbit/oak/plugins/
> > > > > > > > > nodety
> > > > > > > > > pe/w
> > > > > > > > > rite
> > > > > > > > > /Ini
> > > > > > > > > tialContent.java#L119
> > > > > > > > > 
> > > > > > > 
> > > > > 
> > > 


Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Michael Dürig <md...@apache.org>.
See https://issues.apache.org/jira/browse/OAK-4741

On 1.9.16 3:44 , Michael D�rig wrote:
>
> The reason for this is that MemoryNodeStore requires as MemoryNodeState
> passed to its constructor. Apparently this is not the case here:
>
>>         NodeState base =
>> ModifiedNodeState.squeeze(builder.getNodeState());
>>         NodeStore store = new MemoryNodeStore(base);
>>         NodeTypeRegistry.registerBuiltIn(RootFactory.createSystemRoot(
>>                 store, new EditorHook(new CompositeEditorProvider(
>>                 new NamespaceEditorProvider(),
>>                 new TypeEditorProvider())), null, null, null, null));
>
> This is not documented nor does that constructor have the right
> signature. This is a bug and I'll file an issue for it once I come
> around to it.
>
> Michael
>
> On 1.9.16 2:37 , Robert Munteanu wrote:
>> On Thu, 2016-09-01 at 12:19 +0200, Michael D�rig wrote:
>>>
>>>>
>>>>
>>>> I have a failing test in my fork at
>>>>
>>>>   https://github.com/rombert/jackrabbit-oak/
>>>>
>>>> If I run ReadWriteNamespaceRegistryTest from Eclipse it picks up
>>>> all
>>>> fixtures - including the Multiplexing one I added - and fails with
>>>> that
>>>> one.
>>>>
>>>> Getting this isolated would be hard since it requires a full
>>>> NodeStore
>>>> implementation whose NodeState and NodeBuilder implementations
>>>> don't
>>>> extend the memory-based ones.
>>>
>>> Can you share the stack trace of the failing test? Or is this not
>>> helpful as there are too many modifications of Oak's core parts in
>>> your
>>> fork? Otherwise please share and indicate which revision of Oak this
>>> fork is based on.
>>
>> I've pasted the stack trace at the end.
>>
>> As for my changes I have not touched the core parts of oak, the 'java'
>> part is contained in plugins/multiplex and spi/mount . I've recently
>> merged trunk up to r1758729.
>>
>> I am wondering whether the InitialContent wraps the NodeState in a new
>> NodeStore only because it does not have access to the originating
>> NodeStore. That would give an indication of a possible solution.
>>
>> Robert
>>
>> ReadWriteNamespaceRegistryTest.testMappings
>> org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest
>> [MultiplexingSegmentFixture with a mount under /tmp]
>> testMappings[MultiplexingSegmentFixture with a mount under
>> /tmp](org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry
>> Test)
>> java.lang.IllegalArgumentException
>>     at
>> com.google.common.base.Preconditions.checkArgument(Preconditions.java:7
>> 7)
>>     at
>> org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore.merge(MemoryNo
>> deStore.java:126)
>>     at
>> org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:249)
>>     at
>> org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:35)
>>     at
>> org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:260)
>>     at
>> org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:35)
>>     at
>> org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry.regis
>> terNamespace(ReadWriteNamespaceRegistry.java:94)
>>     at
>> org.apache.jackrabbit.commons.cnd.TemplateBuilderFactory.setNamespace(T
>> emplateBuilderFactory.java:92)
>>     at
>> org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.doNameSpace(
>> CompactNodeTypeDefReader.java:246)
>>     at
>> org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.parse(Compac
>> tNodeTypeDefReader.java:200)
>>     at
>> org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(Compa
>> ctNodeTypeDefReader.java:163)
>>     at
>> org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(Compa
>> ctNodeTypeDefReader.java:139)
>>     at
>> org.apache.jackrabbit.commons.cnd.CndImporter.registerNodeTypes(CndImpo
>> rter.java:147)
>>     at
>> org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
>> terNodeTypes(NodeTypeRegistry.java:109)
>>     at
>> org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
>> ter(NodeTypeRegistry.java:104)
>>     at
>> org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
>> terBuiltIn(NodeTypeRegistry.java:86)
>>     at
>> org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.initial
>> ize(InitialContent.java:120)
>>     at
>> org.apache.jackrabbit.oak.spi.lifecycle.CompositeInitializer.initialize
>> (CompositeInitializer.java:48)
>>     at
>> org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize(OakIn
>> itializer.java:42)
>>     at
>> org.apache.jackrabbit.oak.Oak.createNewContentRepository(Oak.java:635)
>>     at
>> org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:623)
>>     at
>> org.apache.jackrabbit.oak.Oak.createContentSession(Oak.java:737)
>>     at
>> org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest.c
>> reateContentSession(ReadWriteNamespaceRegistryTest.java:42)
>>     at
>> org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest.t
>> estMappings(ReadWriteNamespaceRegistryTest.java:47)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
>> va:57)
>>     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
>> rImpl.java:43)
>>     at java.lang.reflect.Method.invoke(Method.java:606)
>>     at
>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMe
>> thod.java:50)
>>     at
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCalla
>> ble.java:12)
>>     at
>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMeth
>> od.java:47)
>>     at
>> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMetho
>> d.java:17)
>>     at
>> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java
>> :27)
>>     at
>> org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>>     at
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
>> r.java:78)
>>     at
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
>> r.java:57)
>>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>>     at
>> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>>     at
>> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>>     at
>> org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>>     at
>> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>>     at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>>     at org.junit.runners.Suite.runChild(Suite.java:128)
>>     at org.junit.runners.Suite.runChild(Suite.java:27)
>>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>>     at
>> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>>     at
>> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>>     at
>> org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>>     at
>> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>>     at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>>     at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Te
>> stReference.java:86)
>>     at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.j
>> ava:38)
>>     at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
>> estRunner.java:459)
>>     at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
>> estRunner.java:678)
>>     at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRu
>> nner.java:382)
>>     at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestR
>> unner.java:192)
>>
>>>
>>> Michaelo
>>>
>>>
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Robert
>>>>
>>>>>
>>>>>
>>>>> Michael
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Robert
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Michael
>>>>>>>
>>>>>>>
>>>>>>> On 1.9.16 9:36 , Robert Munteanu wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm working on implementing a custom node store which
>>>>>>>> multiplexes
>>>>>>>> other
>>>>>>>> node stores.
>>>>>>>>
>>>>>>>> Adding it as a fixture in oak-it results in a test failure
>>>>>>>> in
>>>>>>>>
>>>>>>>>   ReadWriteNamespaceRegistryTest.testMappings [1]
>>>>>>>>
>>>>>>>> The reason is
>>>>>>>> that
>>>>>>>> org.apache.jackrabbit.oak.plugins.nodetype.write.InitialCon
>>>>>>>> tent
>>>>>>>> class wraps the passed nodeStore into a MemoryNodeStore,
>>>>>>>> and
>>>>>>>> that
>>>>>>>> memory node store later on receives a builder which is not
>>>>>>>> MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
>>>>>>>>
>>>>>>>> I'm not familiar enough with that class to propose a fix,
>>>>>>>> but
>>>>>>>> effectively it forces all builders to be
>>>>>>>> MemoryNodeBuilders,
>>>>>>>> which
>>>>>>>> is
>>>>>>>> too restrictive IMO.
>>>>>>>>
>>>>>>>> Is this a bug to file or something that I need to live with
>>>>>>>> when
>>>>>>>> implementing a new NodeStore?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Robert
>>>>>>>>
>>>>>>>>
>>>>>>>> [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874
>>>>>>>> ac4a
>>>>>>>> ab6e
>>>>>>>> 0ffb
>>>>>>>> 085e07642ffa44d8c7ca/oak-
>>>>>>>> it/src/test/java/org/apache/jackrabbit/oak/plugins/name/Rea
>>>>>>>> dWri
>>>>>>>> teNa
>>>>>>>> mesp
>>>>>>>> aceRegistryTest.java#L46
>>>>>>>> [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874
>>>>>>>> ac4a
>>>>>>>> ab6e
>>>>>>>> 0ffb
>>>>>>>> 085e07642ffa44d8c7ca/oak-
>>>>>>>> core/src/main/java/org/apache/jackrabbit/oak/plugins/nodety
>>>>>>>> pe/w
>>>>>>>> rite
>>>>>>>> /Ini
>>>>>>>> tialContent.java#L119
>>>>>>>>
>>>>>>
>>>>
>>

Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Michael Dürig <md...@apache.org>.
The reason for this is that MemoryNodeStore requires as MemoryNodeState 
passed to its constructor. Apparently this is not the case here:

>         NodeState base =
> ModifiedNodeState.squeeze(builder.getNodeState());
>         NodeStore store = new MemoryNodeStore(base);
>         NodeTypeRegistry.registerBuiltIn(RootFactory.createSystemRoot(
>                 store, new EditorHook(new CompositeEditorProvider(
>                 new NamespaceEditorProvider(),
>                 new TypeEditorProvider())), null, null, null, null));

This is not documented nor does that constructor have the right 
signature. This is a bug and I'll file an issue for it once I come 
around to it.

Michael

On 1.9.16 2:37 , Robert Munteanu wrote:
> On Thu, 2016-09-01 at 12:19 +0200, Michael D�rig wrote:
>>
>>>
>>>
>>> I have a failing test in my fork at
>>>
>>>   https://github.com/rombert/jackrabbit-oak/
>>>
>>> If I run ReadWriteNamespaceRegistryTest from Eclipse it picks up
>>> all
>>> fixtures - including the Multiplexing one I added - and fails with
>>> that
>>> one.
>>>
>>> Getting this isolated would be hard since it requires a full
>>> NodeStore
>>> implementation whose NodeState and NodeBuilder implementations
>>> don't
>>> extend the memory-based ones.
>>
>> Can you share the stack trace of the failing test? Or is this not
>> helpful as there are too many modifications of Oak's core parts in
>> your
>> fork? Otherwise please share and indicate which revision of Oak this
>> fork is based on.
>
> I've pasted the stack trace at the end.
>
> As for my changes I have not touched the core parts of oak, the 'java'
> part is contained in plugins/multiplex and spi/mount . I've recently
> merged trunk up to r1758729.
>
> I am wondering whether the InitialContent wraps the NodeState in a new
> NodeStore only because it does not have access to the originating
> NodeStore. That would give an indication of a possible solution.
>
> Robert
>
> ReadWriteNamespaceRegistryTest.testMappings
> org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest
> [MultiplexingSegmentFixture with a mount under /tmp]
> testMappings[MultiplexingSegmentFixture with a mount under
> /tmp](org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry
> Test)
> java.lang.IllegalArgumentException
> 	at
> com.google.common.base.Preconditions.checkArgument(Preconditions.java:7
> 7)
> 	at
> org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore.merge(MemoryNo
> deStore.java:126)
> 	at
> org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:249)
> 	at
> org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:35)
> 	at
> org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:260)
> 	at
> org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:35)
> 	at
> org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry.regis
> terNamespace(ReadWriteNamespaceRegistry.java:94)
> 	at
> org.apache.jackrabbit.commons.cnd.TemplateBuilderFactory.setNamespace(T
> emplateBuilderFactory.java:92)
> 	at
> org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.doNameSpace(
> CompactNodeTypeDefReader.java:246)
> 	at
> org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.parse(Compac
> tNodeTypeDefReader.java:200)
> 	at
> org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(Compa
> ctNodeTypeDefReader.java:163)
> 	at
> org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(Compa
> ctNodeTypeDefReader.java:139)
> 	at
> org.apache.jackrabbit.commons.cnd.CndImporter.registerNodeTypes(CndImpo
> rter.java:147)
> 	at
> org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
> terNodeTypes(NodeTypeRegistry.java:109)
> 	at
> org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
> ter(NodeTypeRegistry.java:104)
> 	at
> org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
> terBuiltIn(NodeTypeRegistry.java:86)
> 	at
> org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.initial
> ize(InitialContent.java:120)
> 	at
> org.apache.jackrabbit.oak.spi.lifecycle.CompositeInitializer.initialize
> (CompositeInitializer.java:48)
> 	at
> org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize(OakIn
> itializer.java:42)
> 	at
> org.apache.jackrabbit.oak.Oak.createNewContentRepository(Oak.java:635)
> 	at
> org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:623)
> 	at
> org.apache.jackrabbit.oak.Oak.createContentSession(Oak.java:737)
> 	at
> org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest.c
> reateContentSession(ReadWriteNamespaceRegistryTest.java:42)
> 	at
> org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest.t
> estMappings(ReadWriteNamespaceRegistryTest.java:47)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
> va:57)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
> rImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMe
> thod.java:50)
> 	at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCalla
> ble.java:12)
> 	at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMeth
> od.java:47)
> 	at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMetho
> d.java:17)
> 	at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java
> :27)
> 	at
> org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> 	at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
> r.java:78)
> 	at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
> r.java:57)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> 	at
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> 	at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> 	at
> org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> 	at
> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> 	at org.junit.runners.Suite.runChild(Suite.java:128)
> 	at org.junit.runners.Suite.runChild(Suite.java:27)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> 	at
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> 	at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> 	at
> org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> 	at
> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> 	at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Te
> stReference.java:86)
> 	at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.j
> ava:38)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
> estRunner.java:459)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
> estRunner.java:678)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRu
> nner.java:382)
> 	at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestR
> unner.java:192)
>
>>
>> Michaelo
>>
>>
>>>
>>>
>>> Thanks,
>>>
>>> Robert
>>>
>>>>
>>>>
>>>> Michael
>>>>
>>>>>
>>>>>
>>>>>
>>>>> Robert
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Michael
>>>>>>
>>>>>>
>>>>>> On 1.9.16 9:36 , Robert Munteanu wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm working on implementing a custom node store which
>>>>>>> multiplexes
>>>>>>> other
>>>>>>> node stores.
>>>>>>>
>>>>>>> Adding it as a fixture in oak-it results in a test failure
>>>>>>> in
>>>>>>>
>>>>>>>   ReadWriteNamespaceRegistryTest.testMappings [1]
>>>>>>>
>>>>>>> The reason is
>>>>>>> that
>>>>>>> org.apache.jackrabbit.oak.plugins.nodetype.write.InitialCon
>>>>>>> tent
>>>>>>> class wraps the passed nodeStore into a MemoryNodeStore,
>>>>>>> and
>>>>>>> that
>>>>>>> memory node store later on receives a builder which is not
>>>>>>> MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
>>>>>>>
>>>>>>> I'm not familiar enough with that class to propose a fix,
>>>>>>> but
>>>>>>> effectively it forces all builders to be
>>>>>>> MemoryNodeBuilders,
>>>>>>> which
>>>>>>> is
>>>>>>> too restrictive IMO.
>>>>>>>
>>>>>>> Is this a bug to file or something that I need to live with
>>>>>>> when
>>>>>>> implementing a new NodeStore?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Robert
>>>>>>>
>>>>>>>
>>>>>>> [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874
>>>>>>> ac4a
>>>>>>> ab6e
>>>>>>> 0ffb
>>>>>>> 085e07642ffa44d8c7ca/oak-
>>>>>>> it/src/test/java/org/apache/jackrabbit/oak/plugins/name/Rea
>>>>>>> dWri
>>>>>>> teNa
>>>>>>> mesp
>>>>>>> aceRegistryTest.java#L46
>>>>>>> [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874
>>>>>>> ac4a
>>>>>>> ab6e
>>>>>>> 0ffb
>>>>>>> 085e07642ffa44d8c7ca/oak-
>>>>>>> core/src/main/java/org/apache/jackrabbit/oak/plugins/nodety
>>>>>>> pe/w
>>>>>>> rite
>>>>>>> /Ini
>>>>>>> tialContent.java#L119
>>>>>>>
>>>>>
>>>
>

Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Robert Munteanu <ro...@apache.org>.
On Thu, 2016-09-01 at 12:19 +0200, Michael D�rig wrote:
> 
> > 
> > 
> > I have a failing test in my fork at
> > 
> > � https://github.com/rombert/jackrabbit-oak/
> > 
> > If I run ReadWriteNamespaceRegistryTest from Eclipse it picks up
> > all
> > fixtures - including the Multiplexing one I added - and fails with
> > that
> > one.
> > 
> > Getting this isolated would be hard since it requires a full
> > NodeStore
> > implementation whose NodeState and NodeBuilder implementations
> > don't
> > extend the memory-based ones.
> 
> Can you share the stack trace of the failing test? Or is this not�
> helpful as there are too many modifications of Oak's core parts in
> your�
> fork? Otherwise please share and indicate which revision of Oak this�
> fork is based on.

I've pasted the stack trace at the end.�

As for my changes I have not touched the core parts of oak, the 'java'
part is contained in plugins/multiplex and spi/mount . I've recently
merged trunk up to r1758729.

I am wondering whether the InitialContent wraps the NodeState in a new
NodeStore only because it does not have access to the originating
NodeStore. That would give an indication of a possible solution.

Robert

ReadWriteNamespaceRegistryTest.testMappings
org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest
[MultiplexingSegmentFixture with a mount under /tmp]
testMappings[MultiplexingSegmentFixture with a mount under
/tmp](org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry
Test)
java.lang.IllegalArgumentException
	at
com.google.common.base.Preconditions.checkArgument(Preconditions.java:7
7)
	at
org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore.merge(MemoryNo
deStore.java:126)
	at
org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:249)
	at
org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:35)
	at
org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:260)
	at
org.apache.jackrabbit.oak.core.SystemRoot.commit(SystemRoot.java:35)
	at
org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistry.regis
terNamespace(ReadWriteNamespaceRegistry.java:94)
	at
org.apache.jackrabbit.commons.cnd.TemplateBuilderFactory.setNamespace(T
emplateBuilderFactory.java:92)
	at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.doNameSpace(
CompactNodeTypeDefReader.java:246)
	at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.parse(Compac
tNodeTypeDefReader.java:200)
	at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(Compa
ctNodeTypeDefReader.java:163)
	at
org.apache.jackrabbit.commons.cnd.CompactNodeTypeDefReader.<init>(Compa
ctNodeTypeDefReader.java:139)
	at
org.apache.jackrabbit.commons.cnd.CndImporter.registerNodeTypes(CndImpo
rter.java:147)
	at
org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
terNodeTypes(NodeTypeRegistry.java:109)
	at
org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
ter(NodeTypeRegistry.java:104)
	at
org.apache.jackrabbit.oak.plugins.nodetype.write.NodeTypeRegistry.regis
terBuiltIn(NodeTypeRegistry.java:86)
	at
org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.initial
ize(InitialContent.java:120)
	at
org.apache.jackrabbit.oak.spi.lifecycle.CompositeInitializer.initialize
(CompositeInitializer.java:48)
	at
org.apache.jackrabbit.oak.spi.lifecycle.OakInitializer.initialize(OakIn
itializer.java:42)
	at
org.apache.jackrabbit.oak.Oak.createNewContentRepository(Oak.java:635)
	at
org.apache.jackrabbit.oak.Oak.createContentRepository(Oak.java:623)
	at
org.apache.jackrabbit.oak.Oak.createContentSession(Oak.java:737)
	at
org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest.c
reateContentSession(ReadWriteNamespaceRegistryTest.java:42)
	at
org.apache.jackrabbit.oak.plugins.name.ReadWriteNamespaceRegistryTest.t
estMappings(ReadWriteNamespaceRegistryTest.java:47)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:57)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMe
thod.java:50)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCalla
ble.java:12)
	at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMeth
od.java:47)
	at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMetho
d.java:17)
	at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java
:27)
	at
org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
r.java:78)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunne
r.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at
org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at
org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at
org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at
org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4Te
stReference.java:86)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.j
ava:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
estRunner.java:459)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteT
estRunner.java:678)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRu
nner.java:382)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestR
unner.java:192)

> 
> Michaelo
> 
> 
> > 
> > 
> > Thanks,
> > 
> > Robert
> > 
> > > 
> > > 
> > > Michael
> > > 
> > > > 
> > > > 
> > > > 
> > > > Robert
> > > > 
> > > > > 
> > > > > 
> > > > > 
> > > > > Michael
> > > > > 
> > > > > 
> > > > > On 1.9.16 9:36 , Robert Munteanu wrote:
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > Hi,
> > > > > > 
> > > > > > I'm working on implementing a custom node store which
> > > > > > multiplexes
> > > > > > other
> > > > > > node stores.
> > > > > > 
> > > > > > Adding it as a fixture in oak-it results in a test failure
> > > > > > in
> > > > > > 
> > > > > > � ReadWriteNamespaceRegistryTest.testMappings [1]
> > > > > > 
> > > > > > The reason is
> > > > > > that
> > > > > > org.apache.jackrabbit.oak.plugins.nodetype.write.InitialCon
> > > > > > tent
> > > > > > class wraps the passed nodeStore into a MemoryNodeStore,
> > > > > > and
> > > > > > that
> > > > > > memory node store later on receives a builder which is not
> > > > > > MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
> > > > > > 
> > > > > > I'm not familiar enough with that class to propose a fix,
> > > > > > but
> > > > > > effectively it forces all builders to be
> > > > > > MemoryNodeBuilders,
> > > > > > which
> > > > > > is
> > > > > > too restrictive IMO.
> > > > > > 
> > > > > > Is this a bug to file or something that I need to live with
> > > > > > when
> > > > > > implementing a new NodeStore?
> > > > > > 
> > > > > > Thanks,
> > > > > > 
> > > > > > Robert
> > > > > > 
> > > > > > 
> > > > > > [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874
> > > > > > ac4a
> > > > > > ab6e
> > > > > > 0ffb
> > > > > > 085e07642ffa44d8c7ca/oak-
> > > > > > it/src/test/java/org/apache/jackrabbit/oak/plugins/name/Rea
> > > > > > dWri
> > > > > > teNa
> > > > > > mesp
> > > > > > aceRegistryTest.java#L46
> > > > > > [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874
> > > > > > ac4a
> > > > > > ab6e
> > > > > > 0ffb
> > > > > > 085e07642ffa44d8c7ca/oak-
> > > > > > core/src/main/java/org/apache/jackrabbit/oak/plugins/nodety
> > > > > > pe/w
> > > > > > rite
> > > > > > /Ini
> > > > > > tialContent.java#L119
> > > > > > 
> > > > 
> > 


Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Michael Dürig <md...@apache.org>.

>
> I have a failing test in my fork at
>
>   https://github.com/rombert/jackrabbit-oak/
>
> If I run ReadWriteNamespaceRegistryTest from Eclipse it picks up all
> fixtures - including the Multiplexing one I added - and fails with that
> one.
>
> Getting this isolated would be hard since it requires a full NodeStore
> implementation whose NodeState and NodeBuilder implementations don't
> extend the memory-based ones.

Can you share the stack trace of the failing test? Or is this not 
helpful as there are too many modifications of Oak's core parts in your 
fork? Otherwise please share and indicate which revision of Oak this 
fork is based on.

Michaelo


>
> Thanks,
>
> Robert
>
>>
>> Michael
>>
>>>
>>>
>>> Robert
>>>
>>>>
>>>>
>>>> Michael
>>>>
>>>>
>>>> On 1.9.16 9:36 , Robert Munteanu wrote:
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm working on implementing a custom node store which
>>>>> multiplexes
>>>>> other
>>>>> node stores.
>>>>>
>>>>> Adding it as a fixture in oak-it results in a test failure in
>>>>>
>>>>>   ReadWriteNamespaceRegistryTest.testMappings [1]
>>>>>
>>>>> The reason is
>>>>> that
>>>>> org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent
>>>>> class wraps the passed nodeStore into a MemoryNodeStore, and
>>>>> that
>>>>> memory node store later on receives a builder which is not
>>>>> MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
>>>>>
>>>>> I'm not familiar enough with that class to propose a fix, but
>>>>> effectively it forces all builders to be MemoryNodeBuilders,
>>>>> which
>>>>> is
>>>>> too restrictive IMO.
>>>>>
>>>>> Is this a bug to file or something that I need to live with
>>>>> when
>>>>> implementing a new NodeStore?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Robert
>>>>>
>>>>>
>>>>> [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4a
>>>>> ab6e
>>>>> 0ffb
>>>>> 085e07642ffa44d8c7ca/oak-
>>>>> it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWri
>>>>> teNa
>>>>> mesp
>>>>> aceRegistryTest.java#L46
>>>>> [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4a
>>>>> ab6e
>>>>> 0ffb
>>>>> 085e07642ffa44d8c7ca/oak-
>>>>> core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/w
>>>>> rite
>>>>> /Ini
>>>>> tialContent.java#L119
>>>>>
>>>
>

Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Robert Munteanu <ro...@apache.org>.
On Thu, 2016-09-01 at 11:14 +0200, Michael D�rig wrote:
> 
> On 1.9.16 10:04 , Robert Munteanu wrote:
> > 
> > 
> > ��������NodeState base =
> > ModifiedNodeState.squeeze(builder.getNodeState());
> > ��������NodeStore store = new MemoryNodeStore(base);
> > ��������NodeTypeRegistry.registerBuiltIn(RootFactory.createSystemRo
> > ot(
> > ����������������store, new EditorHook(new CompositeEditorProvider(
> > ����������������new NamespaceEditorProvider(),
> > ����������������new TypeEditorProvider())), null, null, null,
> > null));
> > 
> > Since the NodeStore is based on a NodeBuilder's current state and
> > that
> > NodeBuilder is not a MemoryNodeBuilder the check that you mentioned
> > is
> > triggered.
> > 
> > The question is - is it correct to use a MemoryNodeStore in this
> > way
> > here?
> 
> �From that part of the code quoted I would say yes. But there seems
> to�
> be a deeper issue hidden below somewhere. Is this something you can�
> isolate into a test case?

I have a failing test in my fork at�

��https://github.com/rombert/jackrabbit-oak/

If I run�ReadWriteNamespaceRegistryTest from Eclipse it picks up all
fixtures - including the Multiplexing one I added - and fails with that
one.

Getting this isolated would be hard since it requires a full NodeStore
implementation whose NodeState and NodeBuilder implementations don't
extend the memory-based ones.

Thanks,

Robert

> 
> Michael
> 
> > 
> > 
> > Robert
> > 
> > > 
> > > 
> > > Michael
> > > 
> > > 
> > > On 1.9.16 9:36 , Robert Munteanu wrote:
> > > > 
> > > > 
> > > > Hi,
> > > > 
> > > > I'm working on implementing a custom node store which
> > > > multiplexes
> > > > other
> > > > node stores.
> > > > 
> > > > Adding it as a fixture in oak-it results in a test failure in
> > > > 
> > > > � ReadWriteNamespaceRegistryTest.testMappings [1]
> > > > 
> > > > The reason is
> > > > that
> > > > org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent
> > > > class wraps the passed nodeStore into a MemoryNodeStore, and
> > > > that
> > > > memory node store later on receives a builder which is not
> > > > MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
> > > > 
> > > > I'm not familiar enough with that class to propose a fix, but
> > > > effectively it forces all builders to be MemoryNodeBuilders,
> > > > which
> > > > is
> > > > too restrictive IMO.
> > > > 
> > > > Is this a bug to file or something that I need to live with
> > > > when
> > > > implementing a new NodeStore?
> > > > 
> > > > Thanks,
> > > > 
> > > > Robert
> > > > 
> > > > 
> > > > [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4a
> > > > ab6e
> > > > 0ffb
> > > > 085e07642ffa44d8c7ca/oak-
> > > > it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWri
> > > > teNa
> > > > mesp
> > > > aceRegistryTest.java#L46
> > > > [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4a
> > > > ab6e
> > > > 0ffb
> > > > 085e07642ffa44d8c7ca/oak-
> > > > core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/w
> > > > rite
> > > > /Ini
> > > > tialContent.java#L119
> > > > 
> > 


Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Michael Dürig <md...@apache.org>.

On 1.9.16 10:04 , Robert Munteanu wrote:
>
>         NodeState base =
> ModifiedNodeState.squeeze(builder.getNodeState());
>         NodeStore store = new MemoryNodeStore(base);
>         NodeTypeRegistry.registerBuiltIn(RootFactory.createSystemRoot(
>                 store, new EditorHook(new CompositeEditorProvider(
>                 new NamespaceEditorProvider(),
>                 new TypeEditorProvider())), null, null, null, null));
>
> Since the NodeStore is based on a NodeBuilder's current state and that
> NodeBuilder is not a MemoryNodeBuilder the check that you mentioned is
> triggered.
>
> The question is - is it correct to use a MemoryNodeStore in this way
> here?

 From that part of the code quoted I would say yes. But there seems to 
be a deeper issue hidden below somewhere. Is this something you can 
isolate into a test case?

Michael

>
> Robert
>
>>
>> Michael
>>
>>
>> On 1.9.16 9:36 , Robert Munteanu wrote:
>>>
>>> Hi,
>>>
>>> I'm working on implementing a custom node store which multiplexes
>>> other
>>> node stores.
>>>
>>> Adding it as a fixture in oak-it results in a test failure in
>>>
>>>   ReadWriteNamespaceRegistryTest.testMappings [1]
>>>
>>> The reason is
>>> that
>>> org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent
>>> class wraps the passed nodeStore into a MemoryNodeStore, and that
>>> memory node store later on receives a builder which is not
>>> MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
>>>
>>> I'm not familiar enough with that class to propose a fix, but
>>> effectively it forces all builders to be MemoryNodeBuilders, which
>>> is
>>> too restrictive IMO.
>>>
>>> Is this a bug to file or something that I need to live with when
>>> implementing a new NodeStore?
>>>
>>> Thanks,
>>>
>>> Robert
>>>
>>>
>>> [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e
>>> 0ffb
>>> 085e07642ffa44d8c7ca/oak-
>>> it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNa
>>> mesp
>>> aceRegistryTest.java#L46
>>> [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e
>>> 0ffb
>>> 085e07642ffa44d8c7ca/oak-
>>> core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write
>>> /Ini
>>> tialContent.java#L119
>>>
>

Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Robert Munteanu <ro...@apache.org>.
Hi,

On Thu, 2016-09-01 at 09:47 +0200, Michael D�rig wrote:
> Hi,
> 
> All methods of the NodeStore API that take a NodeBuilder argument�
> require that NodeBuilder to initially have been acquired from that
> same�
> store. Otherwise the method will throw an IllegalArgumentException.
> E.g.�
> the Javadoc of NodeStore.merge states: "throws
> IllegalArgumentException�
> if the builder is not acquired from a root state of this store".

Yes, agreed.

But in this case the InitialContent class receives a NodeBuilder in the
initialize method, and then passes it to a MemoryNodeStore

� � � � NodeState base =
ModifiedNodeState.squeeze(builder.getNodeState());
��������NodeStore store = new MemoryNodeStore(base);
� � � � NodeTypeRegistry.registerBuiltIn(RootFactory.createSystemRoot(
����������������store, new EditorHook(new CompositeEditorProvider(
����������������new NamespaceEditorProvider(),
����������������new TypeEditorProvider())), null, null, null, null));

Since the NodeStore is based on a NodeBuilder's current state and that
NodeBuilder is not a MemoryNodeBuilder the check that you mentioned is
triggered.

The question is - is it correct to use a MemoryNodeStore in this way
here?

Robert

> 
> Michael
> 
> 
> On 1.9.16 9:36 , Robert Munteanu wrote:
> > 
> > Hi,
> > 
> > I'm working on implementing a custom node store which multiplexes
> > other
> > node stores.
> > 
> > Adding it as a fixture in oak-it results in a test failure in
> > 
> > � ReadWriteNamespaceRegistryTest.testMappings [1]
> > 
> > The reason is
> > that
> > org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent
> > class wraps the passed nodeStore into a MemoryNodeStore, and that
> > memory node store later on receives a builder which is not
> > MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
> > 
> > I'm not familiar enough with that class to propose a fix, but
> > effectively it forces all builders to be MemoryNodeBuilders, which
> > is
> > too restrictive IMO.
> > 
> > Is this a bug to file or something that I need to live with when
> > implementing a new NodeStore?
> > 
> > Thanks,
> > 
> > Robert
> > 
> > 
> > [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e
> > 0ffb
> > 085e07642ffa44d8c7ca/oak-
> > it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNa
> > mesp
> > aceRegistryTest.java#L46
> > [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e
> > 0ffb
> > 085e07642ffa44d8c7ca/oak-
> > core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write
> > /Ini
> > tialContent.java#L119
> > 


Re: Are all NodeBuilders required to inherit from the MemoryNodeBuilder?

Posted by Michael Dürig <md...@apache.org>.
Hi,

All methods of the NodeStore API that take a NodeBuilder argument 
require that NodeBuilder to initially have been acquired from that same 
store. Otherwise the method will throw an IllegalArgumentException. E.g. 
the Javadoc of NodeStore.merge states: "throws IllegalArgumentException 
if the builder is not acquired from a root state of this store".

Michael


On 1.9.16 9:36 , Robert Munteanu wrote:
> Hi,
>
> I'm working on implementing a custom node store which multiplexes other
> node stores.
>
> Adding it as a fixture in oak-it results in a test failure in
>
>   ReadWriteNamespaceRegistryTest.testMappings [1]
>
> The reason is
> that org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent
> class wraps the passed nodeStore into a MemoryNodeStore, and that
> memory node store later on receives a builder which is not
> MemoryNodeBuilder [2] \u2192 IllegalArgumentException.
>
> I'm not familiar enough with that class to propose a fix, but
> effectively it forces all builders to be MemoryNodeBuilders, which is
> too restrictive IMO.
>
> Is this a bug to file or something that I need to live with when
> implementing a new NodeStore?
>
> Thanks,
>
> Robert
>
>
> [1]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e0ffb
> 085e07642ffa44d8c7ca/oak-
> it/src/test/java/org/apache/jackrabbit/oak/plugins/name/ReadWriteNamesp
> aceRegistryTest.java#L46
> [2]: https://github.com/apache/jackrabbit-oak/blob/64f48874ac4aab6e0ffb
> 085e07642ffa44d8c7ca/oak-
> core/src/main/java/org/apache/jackrabbit/oak/plugins/nodetype/write/Ini
> tialContent.java#L119
>