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

Thomas Mueller commented on OAK-333:
------------------------------------

Indexing the hash of the path would be very bad for performance, because it 
would cause nodes that are logically close to each other (have a similar path) 
to be distributed over the whole (possibly sharded) repository. See also  

Shard Keys:
http://docs.mongodb.org/manual/core/sharding-internals/#sharding-internals-shard-keys
 :

Query Isolation:
http://docs.mongodb.org/manual/core/sharding-internals/#sharding-shard-key-query-isolation
"The fastest queries in a sharded environment are those that mongos will route 
to a single shard"

Now, let's assume we use the hash code of the path as the shard key (and not 
the path). If we do that, each query to retrieve a number of nodes with a given 
depth (let's say depth 3) will have to first read the parent node, then for 
each child node read the child node, and so on. That's almost n queries (where 
n is the number of returned nodes)!

When using the path as the shared key, it's just one query (path like '/.../%' 
and depth between 3 and 6), which is routed to just one shard normally, because 
all nodes are stored in the same shard.




                
> 1000 character path limit in MongoMK
> ------------------------------------
>
>                 Key: OAK-333
>                 URL: https://issues.apache.org/jira/browse/OAK-333
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: mk, mongomk
>    Affects Versions: 0.5
>            Reporter: Mete Atamel
>            Assignee: Mete Atamel
>            Priority: Minor
>         Attachments: OAK-333.patch
>
>
> In an infinite loop try to add nodes one under another to have N0/N1/N2...NN. 
> At some point, the current parent node will not be found and the current 
> commit will fail. I think this happens when the path length exceeds 1000 
> characters. Is this enough for a path? I was able to create this way only 222 
> levels in the tree (and my node names were really short N1, N2 ...)
> There's an automated tests for this: NodeExistsCommandMongoTest.testTreeDepth

--
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

Reply via email to