[jira] [Updated] (OAK-507) MicroKernel.commit() throws NotFoundException for an existing node

2013-01-10 Thread Marcel Reutegger (JIRA)

 [ 
https://issues.apache.org/jira/browse/OAK-507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marcel Reutegger updated OAK-507:
-

Attachment: OAK-507.patch

The attached patch changes CommitCommand to useon the revision as passed in 
MK.commit(). If it is null it uses the current head revision. The commit is now 
also evicted from the cache in MongoNodeStore when it fails. I'm not sure if 
it's really needed, but I think it's better to be on the safe side.

I also had to revert the performance optimizations in 
CommitCommandInstructionVisitor.

MongoNode now has a copy() method, which is used when a MongoNode is put into 
the cache. This makes sure the node in the cache is independent and not 
modified by the thread that put it into the cache.

MongoMKBranchMergeTest started to fail with my changes and I think it's because 
the test is wrong. See fixes in there.

Similar in MongoMKCommitRemoveTest. removeAndAddNode() adds a node twice with 
the same revision. IMO this must actually fail. See proposed changes to the 
test.

The patch also fixes the issue described here: 
http://markmail.org/message/ao2fzkrmox4c6cqc

 MicroKernel.commit() throws NotFoundException for an existing node
 --

 Key: OAK-507
 URL: https://issues.apache.org/jira/browse/OAK-507
 Project: Jackrabbit Oak
  Issue Type: Bug
  Components: mk, mongomk
Reporter: Michael Dürig
 Attachments: OAK-507.patch


 {code}
 String base = mk.commit(, +\/a\:{}, null, null);
 mk.commit(, -\/a\, base, null);
 assertTrue(mk.nodeExists(/a, base));
 mk.commit(, -\/a\, base, null);
 {code}
 The last line throws an {{MicroKernelException}} with a {{NotFoundException}} 
 as its cause, which contradicts the preceding assertion.
 {code}
 Exception in thread main org.apache.jackrabbit.mk.api.MicroKernelException: 
 org.apache.jackrabbit.mk.store.NotFoundException: /a
   at 
 org.apache.jackrabbit.mk.core.MicroKernelImpl.commit(MicroKernelImpl.java:499)
   at org.apache.jackrabbit.oak.core.Rebase.testFoo(Rebase.java:587)
   at org.apache.jackrabbit.oak.core.Rebase.main(Rebase.java:577)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
 Caused by: org.apache.jackrabbit.mk.store.NotFoundException: /a
   at 
 org.apache.jackrabbit.mk.model.StagedNodeTree.remove(StagedNodeTree.java:148)
   at 
 org.apache.jackrabbit.mk.model.CommitBuilder$RemoveNode.apply(CommitBuilder.java:293)
   at 
 org.apache.jackrabbit.mk.model.CommitBuilder.doCommit(CommitBuilder.java:120)
   at 
 org.apache.jackrabbit.mk.model.CommitBuilder.doCommit(CommitBuilder.java:94)
   at 
 org.apache.jackrabbit.mk.core.MicroKernelImpl.commit(MicroKernelImpl.java:489)
 {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (OAK-507) MicroKernel.commit() throws NotFoundException for an existing node

2013-01-10 Thread Marcel Reutegger (JIRA)

 [ 
https://issues.apache.org/jira/browse/OAK-507?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Marcel Reutegger updated OAK-507:
-

Attachment: OAK-507.patch

Updated the patch with an additional fix for moves in a branch.

 MicroKernel.commit() throws NotFoundException for an existing node
 --

 Key: OAK-507
 URL: https://issues.apache.org/jira/browse/OAK-507
 Project: Jackrabbit Oak
  Issue Type: Bug
  Components: mk, mongomk
Reporter: Michael Dürig
 Attachments: OAK-507.patch, OAK-507.patch


 {code}
 String base = mk.commit(, +\/a\:{}, null, null);
 mk.commit(, -\/a\, base, null);
 assertTrue(mk.nodeExists(/a, base));
 mk.commit(, -\/a\, base, null);
 {code}
 The last line throws an {{MicroKernelException}} with a {{NotFoundException}} 
 as its cause, which contradicts the preceding assertion.
 {code}
 Exception in thread main org.apache.jackrabbit.mk.api.MicroKernelException: 
 org.apache.jackrabbit.mk.store.NotFoundException: /a
   at 
 org.apache.jackrabbit.mk.core.MicroKernelImpl.commit(MicroKernelImpl.java:499)
   at org.apache.jackrabbit.oak.core.Rebase.testFoo(Rebase.java:587)
   at org.apache.jackrabbit.oak.core.Rebase.main(Rebase.java:577)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at 
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at 
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
 Caused by: org.apache.jackrabbit.mk.store.NotFoundException: /a
   at 
 org.apache.jackrabbit.mk.model.StagedNodeTree.remove(StagedNodeTree.java:148)
   at 
 org.apache.jackrabbit.mk.model.CommitBuilder$RemoveNode.apply(CommitBuilder.java:293)
   at 
 org.apache.jackrabbit.mk.model.CommitBuilder.doCommit(CommitBuilder.java:120)
   at 
 org.apache.jackrabbit.mk.model.CommitBuilder.doCommit(CommitBuilder.java:94)
   at 
 org.apache.jackrabbit.mk.core.MicroKernelImpl.commit(MicroKernelImpl.java:489)
 {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira