Hi,

On Tue, Jan 29, 2013 at 11:10 AM, Jukka Zitting <jukka.zitt...@gmail.com> wrote:
> So, to spark off some discussion on this, see below for my quick draft
> of what such a MongoMK^2 could look like.

Thanks all for feedback!

I've now spent a few days drafting some initial implementation code to
see how such a design would work in practice. The code lives currently
in oak-core under o.a.j.oak.plugings.segment and, even though designed
as MongoMK^2, it's yet neither a MicroKernel nor based on MongoDB. :-)
Instead, to start as simple as possible, I implemented the NodeStore
interface directly with an in-memory backend for storing segments.
Once the implementation is feature-complete, it should be
straightforward to make it use MongoDB and to add a MicroKernel
wrapper.

Excluding those main issues the implementation already works pretty
well. It still lacks a number of features (most notably garbage
collection) and optimizations (templates, O(log n) updates of flat
nodes, etc.), but the basics are already in place. Once I sort out
some remaining merge/rebase issues, the implementation should be good
enough to pass all Oak and JCR tests (see patch below for how I'm
testing). Then my plan is to implement the MongoDB binding and run
some basic performance and scalability benchmarks to get some concrete
numbers before we decide whether this design is worth spending more
time on.

BR,

Jukka Zitting

diff --git a/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
b/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
index 45bd8d3..87337a4 100644
--- a/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
+++ b/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
@@ -32,6 +32,8 @@ import org.apache.jackrabbit.oak.plugins.commit.ConflictHook;
 import org.apache.jackrabbit.oak.plugins.index.CompositeIndexHookProvider;
 import org.apache.jackrabbit.oak.plugins.index.IndexHookManager;
 import org.apache.jackrabbit.oak.plugins.index.IndexHookProvider;
+import org.apache.jackrabbit.oak.plugins.segment.MemoryStore;
+import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeValidatorProvider;
@@ -231,7 +233,8 @@ public class Oak {
     }

     public ContentRepository createContentRepository() {
-        KernelNodeStore store = new KernelNodeStore(kernel);
+        // KernelNodeStore store = new KernelNodeStore(kernel);
+        SegmentNodeStore store = new SegmentNodeStore(new MemoryStore());

         IndexHookProvider indexHooks = CompositeIndexHookProvider
                 .compose(indexHookProviders);

Reply via email to