jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mete Atamel (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OAK-566) MongoMK throws exception when adding nodes concurrently
Date Wed, 23 Jan 2013 09:40:13 GMT

    [ https://issues.apache.org/jira/browse/OAK-566?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13560518#comment-13560518

Mete Atamel commented on OAK-566:

I also looked into this and here's what I think happens:
-Thread1 starts adding /node1 in commit1
-Thread1 adds node1 to the list of children for its parent (i.e. root node) and saves the
root node
-Thread1 saves commit1
-Thread2 stars adding /node2 in commit2
-Thread2 reads root node and its children. At this point, node1 is a valid child of the root
-Thread2 adds node2 to the list of children for root node and saves the root node. At this
point root node has node1 and node2 as children
-Thread2 saves commit2
-Thread1 marks commit1 as invalid due to commit2 which makes node1 invalid as well but the
problem is node1 was already saved as child of root node in commit2
> MongoMK throws exception when adding nodes concurrently
> -------------------------------------------------------
>                 Key: OAK-566
>                 URL: https://issues.apache.org/jira/browse/OAK-566
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: mongomk
>            Reporter: Damien Obrist
>            Priority: Minor
>         Attachments: MongoMKConcurrentAddTest.java
> It seems that there is a problem in the MongoDB microkernel when lots of threads try
to commit new nodes concurrently. I have attached a JUnit test which reproduces the error.
The test creates 16 microkernels, each committing two nodes in a separate thread. Some threads
will throw an exception saying that the node they're trying to commit already exists:
> java.lang.RuntimeException: There's already a child node with name 'node6'
> at org.apache.jackrabbit.mongomk.impl.instruction.CommitCommandInstructionVisitor.visit(CommitCommandInstructionVisitor.java:97)
> at org.apache.jackrabbit.mongomk.impl.instruction.AddNodeInstructionImpl.accept(AddNodeInstructionImpl.java:40)
> at org.apache.jackrabbit.mongomk.impl.command.CommitCommandNew.createMongoNodes(CommitCommandNew.java:155)
> at org.apache.jackrabbit.mongomk.impl.command.CommitCommandNew.execute(CommitCommandNew.java:97)
> at org.apache.jackrabbit.mongomk.impl.command.CommitCommandNew.execute(CommitCommandNew.java:1)
> at org.apache.jackrabbit.mongomk.impl.command.DefaultCommandExecutor.execute(DefaultCommandExecutor.java:38)
> at org.apache.jackrabbit.mongomk.impl.MongoNodeStore.commit(MongoNodeStore.java:110)
> at org.apache.jackrabbit.mongomk.impl.MongoMicroKernel.commit(MongoMicroKernel.java:112)
> ... 7 more
> This cannot be the case however, as the nodes added by the different threads do not overlap
/ conflict. No exceptions are thrown if setting the number of threads to some lower number,
but I have observed that in this case the problem still exists when trying to add a larger
number of nodes (more than just 2).

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

View raw message