jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1535337 [7/11] - in /jackrabbit/site/live/oak/docs: ./ css/ js/
Date Thu, 24 Oct 2013 10:42:03 GMT
Modified: jackrabbit/site/live/oak/docs/mongomk.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/oak/docs/mongomk.html?rev=1535337&r1=1535336&r2=1535337&view=diff
==============================================================================
--- jackrabbit/site/live/oak/docs/mongomk.html (original)
+++ jackrabbit/site/live/oak/docs/mongomk.html Thu Oct 24 10:42:02 2013
@@ -1,610 +1,610 @@
-<!DOCTYPE html>
-<!--
- | Generated by Apache Maven Doxia at 2013-10-15
- | Rendered using Apache Maven Fluido Skin 1.3.0
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-  <head>
-    <meta charset="UTF-8" />
-    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <meta name="Date-Revision-yyyymmdd" content="20131015" />
-    <meta http-equiv="Content-Language" content="en" />
-    <title>Jackrabbit Oak - </title>
-    <link rel="stylesheet" href="./css/apache-maven-fluido-1.3.0.min.css" />
-    <link rel="stylesheet" href="./css/site.css" />
-    <link rel="stylesheet" href="./css/print.css" media="print" />
-
-      
-    <script type="text/javascript" src="./js/apache-maven-fluido-1.3.0.min.js"></script>
-
-    
-            </head>
-        <body class="topBarEnabled">
-          
-    
-    
-            
-    
-    
-    <a href="http://github.com/apache/jackrabbit-oak">
-      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
-        src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
-        alt="Fork me on GitHub">
-    </a>
-  
-                
-                    
-                
-
-    <div id="topbar" class="navbar navbar-fixed-top ">
-      <div class="navbar-inner">
-                <div class="container-fluid">
-        <a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
-          <span class="icon-bar"></span>
-          <span class="icon-bar"></span>
-          <span class="icon-bar"></span>
-        </a>
-                
-                                <ul class="nav">
-                          <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Overview <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="index.html"  title="Jackrabbit Oak">Jackrabbit Oak</a>
-</li>
-                  
-                      <li>      <a href="license.html"  title="License">License</a>
-</li>
-                  
-                      <li>      <a href="downloads.html"  title="Downloads">Downloads</a>
-</li>
-                  
-                      <li>      <a href="from_here.html"  title="From here">From here</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Concepts and architecture <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="overview.html"  title="Overview">Overview</a>
-</li>
-                  
-                      <li>      <a href="nodestate.html"  title="Understanding the node state model">Understanding the node state model</a>
-</li>
-                  
-                      <li>      <a href="microkernel.html"  title="Microkernel">Microkernel</a>
-</li>
-                  
-                      <li>      <a href="query.html"  title="Query">Query</a>
-</li>
-                  
-                      <li>      <a href="blobstore.html"  title="BlobStore">BlobStore</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Using Oak <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="use_getting_started.html"  title="Getting Started">Getting Started</a>
-</li>
-                  
-                      <li>      <a href="differences.html"  title="Differences to Jackrabbit 2">Differences to Jackrabbit 2</a>
-</li>
-                  
-                      <li>      <a href="dos_and_donts.html"  title="Dos and don'ts">Dos and don'ts</a>
-</li>
-                  
-                      <li>      <a href="when_things_go_wrong.html"  title="When things go wrong">When things go wrong</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Developing Oak <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="dev_getting_started.html"  title="Getting Started">Getting Started</a>
-</li>
-                  
-                      <li>      <a href="participating.html"  title="Participating">Participating</a>
-</li>
-                  
-                      <li>      <a href="apidocs/index.html"  title="API docs">API docs</a>
-</li>
-                          </ul>
-      </li>
-                <li class="dropdown">
-        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Links <b class="caret"></b></a>
-        <ul class="dropdown-menu">
-        
-                      <li>      <a href="http://jackrabbit.apache.org/oak"  title="Apache Jackrabbit Oak">Apache Jackrabbit Oak</a>
-</li>
-                  
-                      <li>      <a href="http://jackrabbit.apache.org/"  title="Apache Jackrabbit">Apache Jackrabbit</a>
-</li>
-                          </ul>
-      </li>
-                  </ul>
-          
-          
-          
-                   
-                      </div>
-          
-        </div>
-      </div>
-    </div>
-    
-        <div class="container-fluid">
-          <div id="banner">
-        <div class="pull-left">
-                                <div id="bannerLeft">
-                <h2>Oak Documentation</h2>
-                </div>
-                      </div>
-        <div class="pull-right">  </div>
-        <div class="clear"><hr/></div>
-      </div>
-
-      <div id="breadcrumbs">
-        <ul class="breadcrumb">
-                
-                    
-                  <li id="publishDate">Last Published: 2013-10-15</li>
-                  <li class="divider">|</li> <li id="projectVersion">Version: 0.11-SNAPSHOT</li>
-                      
-                
-                    
-      
-                            </ul>
-      </div>
-
-            
-      <div class="row-fluid">
-        <div id="leftColumn" class="span3">
-          <div class="well sidebar-nav">
-                
-                    
-                <ul class="nav nav-list">
-                    <li class="nav-header">Overview</li>
-                                
-      <li>
-    
-                          <a href="index.html" title="Jackrabbit Oak">
-          <i class="none"></i>
-        Jackrabbit Oak</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="license.html" title="License">
-          <i class="none"></i>
-        License</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="downloads.html" title="Downloads">
-          <i class="none"></i>
-        Downloads</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="from_here.html" title="From here">
-          <i class="none"></i>
-        From here</a>
-            </li>
-                              <li class="nav-header">Concepts and architecture</li>
-                                
-      <li>
-    
-                          <a href="overview.html" title="Overview">
-          <i class="none"></i>
-        Overview</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="nodestate.html" title="Understanding the node state model">
-          <i class="none"></i>
-        Understanding the node state model</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="microkernel.html" title="Microkernel">
-          <i class="none"></i>
-        Microkernel</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="query.html" title="Query">
-          <i class="none"></i>
-        Query</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="blobstore.html" title="BlobStore">
-          <i class="none"></i>
-        BlobStore</a>
-            </li>
-                              <li class="nav-header">Using Oak</li>
-                                
-      <li>
-    
-                          <a href="use_getting_started.html" title="Getting Started">
-          <i class="none"></i>
-        Getting Started</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="differences.html" title="Differences to Jackrabbit 2">
-          <i class="none"></i>
-        Differences to Jackrabbit 2</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="dos_and_donts.html" title="Dos and don'ts">
-          <i class="none"></i>
-        Dos and don'ts</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="when_things_go_wrong.html" title="When things go wrong">
-          <i class="none"></i>
-        When things go wrong</a>
-            </li>
-                              <li class="nav-header">Developing Oak</li>
-                                
-      <li>
-    
-                          <a href="dev_getting_started.html" title="Getting Started">
-          <i class="none"></i>
-        Getting Started</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="participating.html" title="Participating">
-          <i class="none"></i>
-        Participating</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="apidocs/index.html" title="API docs">
-          <i class="none"></i>
-        API docs</a>
-            </li>
-                              <li class="nav-header">Links</li>
-                                
-      <li>
-    
-                          <a href="http://jackrabbit.apache.org/oak" class="externalLink" title="Apache Jackrabbit Oak">
-          <i class="none"></i>
-        Apache Jackrabbit Oak</a>
-            </li>
-                  
-      <li>
-    
-                          <a href="http://jackrabbit.apache.org/" class="externalLink" title="Apache Jackrabbit">
-          <i class="none"></i>
-        Apache Jackrabbit</a>
-            </li>
-            </ul>
-                
-                    
-                
-          <hr class="divider" />
-
-           <div id="poweredBy">
-                   
-    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
-
-    
-    <div class="g-plusone" data-href="http://jackrabbit.apache.org/oak-doc/" data-size="tall" ></div>
-
-                   <div class="clear"></div>
-                            <div class="clear"></div>
-                            <div class="clear"></div>
-                             <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
-        <img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
-      </a>
-                  </div>
-          </div>
-        </div>
-        
-                
-        <div id="bodyColumn"  class="span9" >
-                                  
-            <!-- Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License. --><h1>Oak MongoMK</h1>
-<p>This module contains a <tt>MicroKernel</tt> implementation using MongoDB to persist content.</p>
-<div class="section">
-<h2>Content Model<a name="Content_Model"></a></h2>
-<p>The <tt>MongoMK</tt> stores each node in a separate MongoDB document and updates to a node are stored by adding new revision/value pairs to the document. This way the previous state of a node is preserved and can still be retrieved by a session looking at a given snapshot (revision) of the repository.</p>
-<p>The basic MongoDB document of a node in Oak looks like this:</p>
-
-<div class="source">
-<pre>{
-    &quot;_id&quot; : &quot;1:/node&quot;,
-    &quot;_deleted&quot; : {
-        &quot;r13f3875b5d1-0-1&quot; : &quot;false&quot;
-    },
-    &quot;_lastRev&quot; : {
-        &quot;r0-0-1&quot; : &quot;r13f3875b5d1-0-1&quot;
-    },
-    &quot;_modified&quot; : NumberLong(274208361),
-    &quot;_modCount&quot; : NumberLong(1),
-    &quot;_revisions&quot; : {
-        &quot;r13f3875b5d1-0-1&quot; : &quot;c&quot;
-    }
-}
-</pre></div>
-<p>All fields in the above document are metadata and are not exposed through the Oak API. MongoMK has two types of fields. Simple fields are key/value pairs like the <tt>_id</tt> or <tt>_modified</tt> field. Versioned fields are kept in sub-documents where the key is a revision paired with the value at this revision.</p>
-<p>The <tt>_id</tt> field is used as the primary key and consists of a combination of the depth of the path and the path itself. This is an optimization to align sibling keys in the index.</p>
-<p>The <tt>_deleted</tt> sub-document contains the revision this node was created in. In the above example the root node was created in revision <tt>r13f3875b5d1-0-1</tt>. If the node is later deleted, the <tt>_deleted</tt> sub-document will get a new field with the revision the node was deleted in.</p>
-<p>The sub-document <tt>_lastRev</tt> contains the last revision written to this node by each cluster node. In the above example the MongoMK cluster node with id <tt>1</tt> modified the node the last time in revision <tt>r13f3875b5d1-0-1</tt>, when it created the node. The revision key in the <tt>_lastRev</tt> sub-document is synthetic and the only information actually used by MongoMK is the clusterId. The <tt>_lastRev</tt> sub-document is only updated for non-branch commits or on merge, when changes become visible to all readers.</p>
-<p>The <tt>_modified</tt> field contains an indexed low-resolution timestamp when the node was last modified. The time resolution is five seconds. This field is also updated when a branch commit modifies a node.</p>
-<p>The <tt>_modCount</tt> field contains a modification counter, which is incremented with every change to the document. This field allows MongoMK to perform conditional updates without requesting the whole document.</p>
-<p>Finally, the <tt>_revisions</tt> sub-document contains commit information about changes marked with a revision. E.g. the single entry in the above document tells us that everything marked with revision <tt>r13f3875b5d1-0-1</tt> is committed and therefore valid. In case the change is done in a branch then the value would be the base revision. It is only added for those nodes which happen to be the commit root for any given commit.</p>
-<p>Adding a property <tt>prop</tt> with value <tt>foo</tt> to the node in a next step will result in the following document:</p>
-
-<div class="source">
-<pre>{
-    &quot;_deleted&quot; : {
-        &quot;r13f3875b5d1-0-1&quot; : &quot;false&quot;
-    },
-    &quot;_id&quot; : &quot;1:/node&quot;,
-    &quot;_lastRev&quot; : {
-        &quot;r0-0-1&quot; : &quot;r13f38818ab6-0-1&quot;
-    },
-    &quot;_modified&quot; : NumberLong(274208516),
-    &quot;_modCount&quot; : NumberLong(2),
-    &quot;_revisions&quot; : {
-        &quot;r13f3875b5d1-0-1&quot; : &quot;c&quot;,
-        &quot;r13f38818ab6-0-1&quot; : &quot;c&quot;
-    },
-    &quot;prop&quot; : {
-        &quot;r13f38818ab6-0-1&quot; : &quot;\&quot;foo\&quot;&quot;
-    }
-}
-</pre></div>
-<p>Now the document contains a new sub-document with the name of the new property. The value of the property is annotated with the revision the property was set. With each successful commit to this node, a new field is added to the <tt>_revisions</tt> sub-document. Similarly the <tt>_lastRev</tt> sub-document and <tt>_modified</tt> field are updated.</p>
-<p>After the node is deleted the document looks like this:</p>
-
-<div class="source">
-<pre>{
-    &quot;_deleted&quot; : {
-        &quot;r13f3875b5d1-0-1&quot; : &quot;false&quot;,
-        &quot;r13f38835063-2-1&quot; : &quot;true&quot;
-    },
-    &quot;_id&quot; : &quot;1:/node&quot;,
-    &quot;_lastRev&quot; : {
-        &quot;r0-0-1&quot; : &quot;r13f38835063-2-1&quot;
-    },
-    &quot;_modified&quot; : NumberLong(274208539),
-    &quot;_modCount&quot; : NumberLong(3),
-    &quot;_revisions&quot; : {
-        &quot;r13f3875b5d1-0-1&quot; : &quot;c&quot;,
-        &quot;r13f38818ab6-0-1&quot; : &quot;c&quot;,
-        &quot;r13f38835063-2-1&quot; : &quot;c&quot;
-    },
-    &quot;prop&quot; : {
-        &quot;r13f38818ab6-0-1&quot; : &quot;\&quot;foo\&quot;&quot;
-    }
-}
-</pre></div>
-<p>The <tt>_deleted</tt> sub-document now contains a <tt>r13f38835063-2-1</tt> field marking the node as deleted in this revision.</p>
-<p>Reading the node in previous revisions is still possible, even if it is now marked as deleted as of revision <tt>r13f38835063-2-1</tt>.</p></div>
-<div class="section">
-<h2>Revisions<a name="Revisions"></a></h2>
-<p>As seen in the examples above, a revision is a String and may look like this: <tt>r13f38835063-2-1</tt>. It consists of three parts:</p>
-
-<ul>
-  
-<li>A timestamp derived from the system time of the machine it was generated on: <tt>13f38835063</tt></li>
-  
-<li>A counter to distinguish revisions created with the same timestamp: <tt>-2</tt></li>
-  
-<li>The cluster node id where this revision was created: <tt>-1</tt></li>
-</ul></div>
-<div class="section">
-<h2>Branches<a name="Branches"></a></h2>
-<p>MicroKernel implementations support branches, which allows a client to stage multiple commits and make them visible with a single merge call. In MongoMK a branch commit looks very similar to a regular commit, but instead of setting the value of an entry in <tt>_revisions</tt> to <tt>c</tt> (committed), it marks it with the base revision of the branch commit. In contrast to regular commits where the commit root is the common ancestor of all nodes modified in a commit, the commit root of a branch commit is always the root node. This is because a branch will likely have multiple commits and a commit root must already be known when the first commit happens on a branch. To make sure the following branch commits can use the same commit root, MongoMK simply picks the root node, which always works in this case.</p>
-<p>A root node may look like this:</p>
-
-<div class="source">
-<pre>{
-    &quot;_deleted&quot; : {
-        &quot;r13fcda88ac0-0-1&quot; : &quot;false&quot;,
-    },
-    &quot;_id&quot; : &quot;0:/&quot;,
-    &quot;_lastRev&quot; : {
-        &quot;r0-0-1&quot; : &quot;r13fcda91720-0-1&quot;
-    },
-    &quot;_modified&quot; : NumberLong(274708995),
-    &quot;_modCount&quot; : NumberLong(2),
-    &quot;_revisions&quot; : {
-        &quot;r13fcda88ac0-0-1&quot; : &quot;c&quot;,
-        &quot;r13fcda91720-0-1&quot; : &quot;c&quot;
-    },
-    &quot;prop&quot; : {
-        &quot;r13fcda91720-0-1&quot; : &quot;\&quot;foo\&quot;&quot;
-    }
-}
-</pre></div>
-<p>The root node was created in revision <tt>r13fcda88ac0-0-1</tt> and later in revision <tt>r13fcda91720-0-1</tt> property <tt>prop</tt> was set to <tt>foo</tt>. To keep the example simple, we now assume a branch is created based on the revision the root node was last modified and a branch commit is done to modify the existing property. After the branch commit the root node looks like this:</p>
-
-<div class="source">
-<pre>{
-    &quot;_deleted&quot; : {
-        &quot;r13fcda88ac0-0-1&quot; : &quot;false&quot;,
-    },
-    &quot;_id&quot; : &quot;0:/&quot;,
-    &quot;_lastRev&quot; : {
-        &quot;r0-0-1&quot; : &quot;r13fcda91720-0-1&quot;
-    },
-    &quot;_modified&quot; : NumberLong(274708995),
-    &quot;_modCount&quot; : NumberLong(3),
-    &quot;_revisions&quot; : {
-        &quot;r13fcda88ac0-0-1&quot; : &quot;c&quot;,
-        &quot;r13fcda91720-0-1&quot; : &quot;c&quot;,
-       &quot;r13fcda919eb-0-1&quot; : &quot;r13fcda91720-0-1&quot;
-    },
-    &quot;prop&quot; : {
-        &quot;r13fcda91720-0-1&quot; : &quot;\&quot;foo\&quot;&quot;,
-       &quot;r13fcda919eb-0-1&quot; : &quot;\&quot;bar\&quot;&quot;,
-    }
-}
-</pre></div>
-<p>At this point the modified property is only visible to a reader when it reads with the branch revision <tt>r13fcda919eb-0-1</tt> because the revision is marked with the base version of this commit in the <tt>_revisions</tt> sub-document. Note, the <tt>_lastRev</tt> is not updated for branch commits but only when a branch is merged.</p>
-<p>When the branch is later merged, the root node will look like this:</p>
-
-<div class="source">
-<pre>{
-    &quot;_deleted&quot; : {
-        &quot;r13fcda88ac0-0-1&quot; : &quot;false&quot;,
-    },
-    &quot;_id&quot; : &quot;0:/&quot;,
-    &quot;_lastRev&quot; : {
-        &quot;r0-0-1&quot; : &quot;r13fcda91b12-0-1&quot;
-    },
-    &quot;_modified&quot; : NumberLong(274708995),
-    &quot;_modCount&quot; : NumberLong(4),
-    &quot;_revisions&quot; : {
-        &quot;r13fcda88ac0-0-1&quot; : &quot;c&quot;,
-        &quot;r13fcda91720-0-1&quot; : &quot;c&quot;,
-       &quot;r13fcda919eb-0-1&quot; : &quot;c-r13fcda91b12-0-1&quot;
-    },
-    &quot;prop&quot; : {
-        &quot;r13fcda91720-0-1&quot; : &quot;\&quot;foo\&quot;&quot;,
-       &quot;r13fcda919eb-0-1&quot; : &quot;\&quot;bar\&quot;&quot;,
-    }
-}
-</pre></div>
-<p>Now, the changed property is visible to readers with a revision equal or newer than <tt>r13fcda91b12-0-1</tt>.</p>
-<p>The same logic is used for changes to other nodes that belong to a branch commit. MongoMK internally resolves the commit revision for a modification before it decides whether a reader is able to see a given change.</p></div>
-<div class="section">
-<h2>Previous Documents<a name="Previous_Documents"></a></h2>
-<p>Over time the size of a document grows because MongoMK adds data to the document with every modification, but never deletes anything to keep the history. Old data is moved when there are 1000 commits to be moved or the document is bigger than 1 MB. A document with a reference to old data looks like this:</p>
-
-<div class="source">
-<pre>{
-    &quot;_deleted&quot; : {
-        &quot;r13fcda88ac0-0-1&quot; : &quot;false&quot;,
-    },
-    &quot;_id&quot; : &quot;0:/&quot;,
-    &quot;_lastRev&quot; : {
-        &quot;r0-0-1&quot; : &quot;r13fcda91b12-0-1&quot;
-    },
-    &quot;_modified&quot; : NumberLong(274708995),
-    &quot;_modCount&quot; : NumberLong(1004),
-    &quot;_revisions&quot; : {
-        &quot;r13fcda88ac0-0-1&quot; : &quot;c&quot;,
-        &quot;r13fcda91720-0-1&quot; : &quot;c&quot;,
-       &quot;r13fcda919eb-0-1&quot; : &quot;c-r13fcda91b12-0-1&quot;
-    },
-    &quot;_prev&quot; : {
-        &quot;r13fcda88ae0-0-1&quot; : &quot;r13fcda91710-0-1&quot;
-    },
-    &quot;prop&quot; : {
-        &quot;r13fcda91720-0-1&quot; : &quot;\&quot;foo\&quot;&quot;,
-       &quot;r13fcda919eb-0-1&quot; : &quot;\&quot;bar\&quot;&quot;,
-    }
-}
-</pre></div>
-<p>The optional sub-document <tt>_prev</tt> contains a list of revision pairs, each indicating the range of commit revisions a previous document contains. In the above example there is one document with previous commits from <tt>r13fcda88ae0-0-1</tt> to <tt>r13fcda91710-0-1</tt>. The id of the previous document is derived from the upper bound of the range and the id/path of the current document. The id of the previous document for <tt>r13fcda88ae0-0-1</tt> and <tt>0:/</tt> is <tt>1:p/r13fcda88ae0-0-1</tt> and may looks like this:</p>
-
-<div class="source">
-<pre>{
-    &quot;_id&quot; : &quot;1:p/r13fcda88ae0-0-1&quot;,
-    &quot;_modCount&quot; : NumberLong(1),
-    &quot;_revisions&quot; : {
-        &quot;r13fcda88ae0-0-1&quot; : &quot;c&quot;,
-        &quot;r13fcda88af0-0-1&quot; : &quot;c&quot;,
-        ...  
-       &quot;r13fcda91710-0-1&quot; : &quot;c&quot;
-    },
-    &quot;prop&quot; : {
-        &quot;r13fcda88ae0-0-1&quot; : &quot;\&quot;foo\&quot;&quot;,
-        &quot;r13fcda88af0-0-1&quot; : &quot;\&quot;bar\&quot;&quot;,
-        ...
-       &quot;r13fcda91710-0-1&quot; : &quot;\&quot;baz\&quot;&quot;
-    }
-}
-</pre></div>
-<p>Previous documents only contain immutable data, which means it only contains committed and merged <tt>_revisions</tt>. This also means the previous ranges of committed data may overlap because branch commits are not moved to previous documents until the branch is merged.</p></div>
-<div class="section">
-<h2>Background Operations<a name="Background_Operations"></a></h2>
-<p>Each MongoMK instance connecting to same database in Mongo server performs certain background task.</p>
-<div class="section">
-<h3>Renew Cluster Id Lease<a name="Renew_Cluster_Id_Lease"></a></h3></div>
-<div class="section">
-<h3>Background Document Split<a name="Background_Document_Split"></a></h3>
-<p>MongoMK periodically checks documents for their size and if necessary splits them up and moves old data to a previous document. This is done in the background by each MongoMK instance for the data it created.</p></div>
-<div class="section">
-<h3>Background Writes<a name="Background_Writes"></a></h3>
-<p>While performing commits there are certain nodes which are modified but do not become part of commit. For example when a node under /a/b/c is updated then the <tt>_lastRev</tt> property of all ancestors also need to be updated to the commit revision. Such changes are accumulated and flushed periodically through a asynchronous job.</p></div>
-<div class="section">
-<h3>Background Reads<a name="Background_Reads"></a></h3>
-<p>MongoMK periodically picks up changes from other MongoMK instances by polling the root node for changes of <tt>_lastRev</tt>. This happens once every second.</p></div></div>
-<div class="section">
-<h2>Pending Topics<a name="Pending_Topics"></a></h2>
-<div class="section">
-<h3>Conflict Detection and Handling<a name="Conflict_Detection_and_Handling"></a></h3></div></div>
-<div class="section">
-<h2>License<a name="License"></a></h2>
-<p>(see the top-level <a href="../LICENSE.txt">LICENSE.txt</a> for full license details)</p>
-<p>Collective work: Copyright 2013 The Apache Software Foundation.</p>
-<p>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the &#x201c;License&#x201d;); you may not use this file except in compliance with the License. You may obtain a copy of the License at</p>
-
-<div class="source">
-<pre> http://www.apache.org/licenses/LICENSE-2.0
-</pre></div>
-<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &#x201c;AS IS&#x201d; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p></div>
-                  </div>
-            </div>
-          </div>
-
-    <hr/>
-
-    <footer>
-            <div class="container-fluid">
-              <div class="row span12">Copyright &copy;                    2012-2013
-                        <a href="http://www.apache.org/">The Apache Software Foundation</a>.
-            All Rights Reserved.      
-                    
-      </div>
-
-        
-        
-          
-    
-    
-    <div id="ohloh" class="pull-right">
-      <script type="text/javascript" src="http://www.ohloh.net/p/jackrabbit-oak/widgets/project_users_logo.js"></script>
-    </div>
-        </div>
-    </footer>
-  </body>
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia at 2013-10-24
+ | Rendered using Apache Maven Fluido Skin 1.3.0
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+    <meta name="Date-Revision-yyyymmdd" content="20131024" />
+    <meta http-equiv="Content-Language" content="en" />
+    <title>Jackrabbit Oak - </title>
+    <link rel="stylesheet" href="./css/apache-maven-fluido-1.3.0.min.css" />
+    <link rel="stylesheet" href="./css/site.css" />
+    <link rel="stylesheet" href="./css/print.css" media="print" />
+
+      
+    <script type="text/javascript" src="./js/apache-maven-fluido-1.3.0.min.js"></script>
+
+    
+            </head>
+        <body class="topBarEnabled">
+          
+    
+    
+            
+    
+    
+    <a href="http://github.com/apache/jackrabbit-oak">
+      <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;"
+        src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"
+        alt="Fork me on GitHub">
+    </a>
+  
+                
+                    
+                
+
+    <div id="topbar" class="navbar navbar-fixed-top ">
+      <div class="navbar-inner">
+                <div class="container-fluid">
+        <a data-target=".nav-collapse" data-toggle="collapse" class="btn btn-navbar">
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+          <span class="icon-bar"></span>
+        </a>
+                
+                                <ul class="nav">
+                          <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Overview <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="index.html"  title="Jackrabbit Oak">Jackrabbit Oak</a>
+</li>
+                  
+                      <li>      <a href="license.html"  title="License">License</a>
+</li>
+                  
+                      <li>      <a href="downloads.html"  title="Downloads">Downloads</a>
+</li>
+                  
+                      <li>      <a href="from_here.html"  title="From here">From here</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Concepts and architecture <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="overview.html"  title="Overview">Overview</a>
+</li>
+                  
+                      <li>      <a href="nodestate.html"  title="Understanding the node state model">Understanding the node state model</a>
+</li>
+                  
+                      <li>      <a href="microkernel.html"  title="Microkernel">Microkernel</a>
+</li>
+                  
+                      <li>      <a href="query.html"  title="Query">Query</a>
+</li>
+                  
+                      <li>      <a href="blobstore.html"  title="BlobStore">BlobStore</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Using Oak <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="use_getting_started.html"  title="Getting Started">Getting Started</a>
+</li>
+                  
+                      <li>      <a href="differences.html"  title="Differences to Jackrabbit 2">Differences to Jackrabbit 2</a>
+</li>
+                  
+                      <li>      <a href="dos_and_donts.html"  title="Dos and don'ts">Dos and don'ts</a>
+</li>
+                  
+                      <li>      <a href="when_things_go_wrong.html"  title="When things go wrong">When things go wrong</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Developing Oak <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="dev_getting_started.html"  title="Getting Started">Getting Started</a>
+</li>
+                  
+                      <li>      <a href="participating.html"  title="Participating">Participating</a>
+</li>
+                  
+                      <li>      <a href="apidocs/index.html"  title="API docs">API docs</a>
+</li>
+                          </ul>
+      </li>
+                <li class="dropdown">
+        <a href="#" class="dropdown-toggle" data-toggle="dropdown">Links <b class="caret"></b></a>
+        <ul class="dropdown-menu">
+        
+                      <li>      <a href="http://jackrabbit.apache.org/oak"  title="Apache Jackrabbit Oak">Apache Jackrabbit Oak</a>
+</li>
+                  
+                      <li>      <a href="http://jackrabbit.apache.org/"  title="Apache Jackrabbit">Apache Jackrabbit</a>
+</li>
+                          </ul>
+      </li>
+                  </ul>
+          
+          
+          
+                   
+                      </div>
+          
+        </div>
+      </div>
+    </div>
+    
+        <div class="container-fluid">
+          <div id="banner">
+        <div class="pull-left">
+                                <div id="bannerLeft">
+                <h2>Oak Documentation</h2>
+                </div>
+                      </div>
+        <div class="pull-right">  </div>
+        <div class="clear"><hr/></div>
+      </div>
+
+      <div id="breadcrumbs">
+        <ul class="breadcrumb">
+                
+                    
+                  <li id="publishDate">Last Published: 2013-10-24</li>
+                  <li class="divider">|</li> <li id="projectVersion">Version: 0.11-SNAPSHOT</li>
+                      
+                
+                    
+      
+                            </ul>
+      </div>
+
+            
+      <div class="row-fluid">
+        <div id="leftColumn" class="span3">
+          <div class="well sidebar-nav">
+                
+                    
+                <ul class="nav nav-list">
+                    <li class="nav-header">Overview</li>
+                                
+      <li>
+    
+                          <a href="index.html" title="Jackrabbit Oak">
+          <i class="none"></i>
+        Jackrabbit Oak</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="license.html" title="License">
+          <i class="none"></i>
+        License</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="downloads.html" title="Downloads">
+          <i class="none"></i>
+        Downloads</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="from_here.html" title="From here">
+          <i class="none"></i>
+        From here</a>
+            </li>
+                              <li class="nav-header">Concepts and architecture</li>
+                                
+      <li>
+    
+                          <a href="overview.html" title="Overview">
+          <i class="none"></i>
+        Overview</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="nodestate.html" title="Understanding the node state model">
+          <i class="none"></i>
+        Understanding the node state model</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="microkernel.html" title="Microkernel">
+          <i class="none"></i>
+        Microkernel</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="query.html" title="Query">
+          <i class="none"></i>
+        Query</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="blobstore.html" title="BlobStore">
+          <i class="none"></i>
+        BlobStore</a>
+            </li>
+                              <li class="nav-header">Using Oak</li>
+                                
+      <li>
+    
+                          <a href="use_getting_started.html" title="Getting Started">
+          <i class="none"></i>
+        Getting Started</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="differences.html" title="Differences to Jackrabbit 2">
+          <i class="none"></i>
+        Differences to Jackrabbit 2</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="dos_and_donts.html" title="Dos and don'ts">
+          <i class="none"></i>
+        Dos and don'ts</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="when_things_go_wrong.html" title="When things go wrong">
+          <i class="none"></i>
+        When things go wrong</a>
+            </li>
+                              <li class="nav-header">Developing Oak</li>
+                                
+      <li>
+    
+                          <a href="dev_getting_started.html" title="Getting Started">
+          <i class="none"></i>
+        Getting Started</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="participating.html" title="Participating">
+          <i class="none"></i>
+        Participating</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="apidocs/index.html" title="API docs">
+          <i class="none"></i>
+        API docs</a>
+            </li>
+                              <li class="nav-header">Links</li>
+                                
+      <li>
+    
+                          <a href="http://jackrabbit.apache.org/oak" class="externalLink" title="Apache Jackrabbit Oak">
+          <i class="none"></i>
+        Apache Jackrabbit Oak</a>
+            </li>
+                  
+      <li>
+    
+                          <a href="http://jackrabbit.apache.org/" class="externalLink" title="Apache Jackrabbit">
+          <i class="none"></i>
+        Apache Jackrabbit</a>
+            </li>
+            </ul>
+                
+                    
+                
+          <hr class="divider" />
+
+           <div id="poweredBy">
+                   
+    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
+
+    
+    <div class="g-plusone" data-href="http://jackrabbit.apache.org/oak-doc/" data-size="tall" ></div>
+
+                   <div class="clear"></div>
+                            <div class="clear"></div>
+                            <div class="clear"></div>
+                             <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
+        <img class="builtBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
+      </a>
+                  </div>
+          </div>
+        </div>
+        
+                
+        <div id="bodyColumn"  class="span9" >
+                                  
+            <!-- Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License. --><h1>Oak MongoMK</h1>
+<p>This module contains a <tt>MicroKernel</tt> implementation using MongoDB to persist content.</p>
+<div class="section">
+<h2>Content Model<a name="Content_Model"></a></h2>
+<p>The <tt>MongoMK</tt> stores each node in a separate MongoDB document and updates to a node are stored by adding new revision/value pairs to the document. This way the previous state of a node is preserved and can still be retrieved by a session looking at a given snapshot (revision) of the repository.</p>
+<p>The basic MongoDB document of a node in Oak looks like this:</p>
+
+<div class="source">
+<pre>{
+    &quot;_id&quot; : &quot;1:/node&quot;,
+    &quot;_deleted&quot; : {
+        &quot;r13f3875b5d1-0-1&quot; : &quot;false&quot;
+    },
+    &quot;_lastRev&quot; : {
+        &quot;r0-0-1&quot; : &quot;r13f3875b5d1-0-1&quot;
+    },
+    &quot;_modified&quot; : NumberLong(274208361),
+    &quot;_modCount&quot; : NumberLong(1),
+    &quot;_revisions&quot; : {
+        &quot;r13f3875b5d1-0-1&quot; : &quot;c&quot;
+    }
+}
+</pre></div>
+<p>All fields in the above document are metadata and are not exposed through the Oak API. MongoMK has two types of fields. Simple fields are key/value pairs like the <tt>_id</tt> or <tt>_modified</tt> field. Versioned fields are kept in sub-documents where the key is a revision paired with the value at this revision.</p>
+<p>The <tt>_id</tt> field is used as the primary key and consists of a combination of the depth of the path and the path itself. This is an optimization to align sibling keys in the index.</p>
+<p>The <tt>_deleted</tt> sub-document contains the revision this node was created in. In the above example the root node was created in revision <tt>r13f3875b5d1-0-1</tt>. If the node is later deleted, the <tt>_deleted</tt> sub-document will get a new field with the revision the node was deleted in.</p>
+<p>The sub-document <tt>_lastRev</tt> contains the last revision written to this node by each cluster node. In the above example the MongoMK cluster node with id <tt>1</tt> modified the node the last time in revision <tt>r13f3875b5d1-0-1</tt>, when it created the node. The revision key in the <tt>_lastRev</tt> sub-document is synthetic and the only information actually used by MongoMK is the clusterId. The <tt>_lastRev</tt> sub-document is only updated for non-branch commits or on merge, when changes become visible to all readers.</p>
+<p>The <tt>_modified</tt> field contains an indexed low-resolution timestamp when the node was last modified. The time resolution is five seconds. This field is also updated when a branch commit modifies a node.</p>
+<p>The <tt>_modCount</tt> field contains a modification counter, which is incremented with every change to the document. This field allows MongoMK to perform conditional updates without requesting the whole document.</p>
+<p>Finally, the <tt>_revisions</tt> sub-document contains commit information about changes marked with a revision. E.g. the single entry in the above document tells us that everything marked with revision <tt>r13f3875b5d1-0-1</tt> is committed and therefore valid. In case the change is done in a branch then the value would be the base revision. It is only added for those nodes which happen to be the commit root for any given commit.</p>
+<p>Adding a property <tt>prop</tt> with value <tt>foo</tt> to the node in a next step will result in the following document:</p>
+
+<div class="source">
+<pre>{
+    &quot;_deleted&quot; : {
+        &quot;r13f3875b5d1-0-1&quot; : &quot;false&quot;
+    },
+    &quot;_id&quot; : &quot;1:/node&quot;,
+    &quot;_lastRev&quot; : {
+        &quot;r0-0-1&quot; : &quot;r13f38818ab6-0-1&quot;
+    },
+    &quot;_modified&quot; : NumberLong(274208516),
+    &quot;_modCount&quot; : NumberLong(2),
+    &quot;_revisions&quot; : {
+        &quot;r13f3875b5d1-0-1&quot; : &quot;c&quot;,
+        &quot;r13f38818ab6-0-1&quot; : &quot;c&quot;
+    },
+    &quot;prop&quot; : {
+        &quot;r13f38818ab6-0-1&quot; : &quot;\&quot;foo\&quot;&quot;
+    }
+}
+</pre></div>
+<p>Now the document contains a new sub-document with the name of the new property. The value of the property is annotated with the revision the property was set. With each successful commit to this node, a new field is added to the <tt>_revisions</tt> sub-document. Similarly the <tt>_lastRev</tt> sub-document and <tt>_modified</tt> field are updated.</p>
+<p>After the node is deleted the document looks like this:</p>
+
+<div class="source">
+<pre>{
+    &quot;_deleted&quot; : {
+        &quot;r13f3875b5d1-0-1&quot; : &quot;false&quot;,
+        &quot;r13f38835063-2-1&quot; : &quot;true&quot;
+    },
+    &quot;_id&quot; : &quot;1:/node&quot;,
+    &quot;_lastRev&quot; : {
+        &quot;r0-0-1&quot; : &quot;r13f38835063-2-1&quot;
+    },
+    &quot;_modified&quot; : NumberLong(274208539),
+    &quot;_modCount&quot; : NumberLong(3),
+    &quot;_revisions&quot; : {
+        &quot;r13f3875b5d1-0-1&quot; : &quot;c&quot;,
+        &quot;r13f38818ab6-0-1&quot; : &quot;c&quot;,
+        &quot;r13f38835063-2-1&quot; : &quot;c&quot;
+    },
+    &quot;prop&quot; : {
+        &quot;r13f38818ab6-0-1&quot; : &quot;\&quot;foo\&quot;&quot;
+    }
+}
+</pre></div>
+<p>The <tt>_deleted</tt> sub-document now contains a <tt>r13f38835063-2-1</tt> field marking the node as deleted in this revision.</p>
+<p>Reading the node in previous revisions is still possible, even if it is now marked as deleted as of revision <tt>r13f38835063-2-1</tt>.</p></div>
+<div class="section">
+<h2>Revisions<a name="Revisions"></a></h2>
+<p>As seen in the examples above, a revision is a String and may look like this: <tt>r13f38835063-2-1</tt>. It consists of three parts:</p>
+
+<ul>
+  
+<li>A timestamp derived from the system time of the machine it was generated on: <tt>13f38835063</tt></li>
+  
+<li>A counter to distinguish revisions created with the same timestamp: <tt>-2</tt></li>
+  
+<li>The cluster node id where this revision was created: <tt>-1</tt></li>
+</ul></div>
+<div class="section">
+<h2>Branches<a name="Branches"></a></h2>
+<p>MicroKernel implementations support branches, which allows a client to stage multiple commits and make them visible with a single merge call. In MongoMK a branch commit looks very similar to a regular commit, but instead of setting the value of an entry in <tt>_revisions</tt> to <tt>c</tt> (committed), it marks it with the base revision of the branch commit. In contrast to regular commits where the commit root is the common ancestor of all nodes modified in a commit, the commit root of a branch commit is always the root node. This is because a branch will likely have multiple commits and a commit root must already be known when the first commit happens on a branch. To make sure the following branch commits can use the same commit root, MongoMK simply picks the root node, which always works in this case.</p>
+<p>A root node may look like this:</p>
+
+<div class="source">
+<pre>{
+    &quot;_deleted&quot; : {
+        &quot;r13fcda88ac0-0-1&quot; : &quot;false&quot;,
+    },
+    &quot;_id&quot; : &quot;0:/&quot;,
+    &quot;_lastRev&quot; : {
+        &quot;r0-0-1&quot; : &quot;r13fcda91720-0-1&quot;
+    },
+    &quot;_modified&quot; : NumberLong(274708995),
+    &quot;_modCount&quot; : NumberLong(2),
+    &quot;_revisions&quot; : {
+        &quot;r13fcda88ac0-0-1&quot; : &quot;c&quot;,
+        &quot;r13fcda91720-0-1&quot; : &quot;c&quot;
+    },
+    &quot;prop&quot; : {
+        &quot;r13fcda91720-0-1&quot; : &quot;\&quot;foo\&quot;&quot;
+    }
+}
+</pre></div>
+<p>The root node was created in revision <tt>r13fcda88ac0-0-1</tt> and later in revision <tt>r13fcda91720-0-1</tt> property <tt>prop</tt> was set to <tt>foo</tt>. To keep the example simple, we now assume a branch is created based on the revision the root node was last modified and a branch commit is done to modify the existing property. After the branch commit the root node looks like this:</p>
+
+<div class="source">
+<pre>{
+    &quot;_deleted&quot; : {
+        &quot;r13fcda88ac0-0-1&quot; : &quot;false&quot;,
+    },
+    &quot;_id&quot; : &quot;0:/&quot;,
+    &quot;_lastRev&quot; : {
+        &quot;r0-0-1&quot; : &quot;r13fcda91720-0-1&quot;
+    },
+    &quot;_modified&quot; : NumberLong(274708995),
+    &quot;_modCount&quot; : NumberLong(3),
+    &quot;_revisions&quot; : {
+        &quot;r13fcda88ac0-0-1&quot; : &quot;c&quot;,
+        &quot;r13fcda91720-0-1&quot; : &quot;c&quot;,
+       &quot;r13fcda919eb-0-1&quot; : &quot;r13fcda91720-0-1&quot;
+    },
+    &quot;prop&quot; : {
+        &quot;r13fcda91720-0-1&quot; : &quot;\&quot;foo\&quot;&quot;,
+       &quot;r13fcda919eb-0-1&quot; : &quot;\&quot;bar\&quot;&quot;,
+    }
+}
+</pre></div>
+<p>At this point the modified property is only visible to a reader when it reads with the branch revision <tt>r13fcda919eb-0-1</tt> because the revision is marked with the base version of this commit in the <tt>_revisions</tt> sub-document. Note, the <tt>_lastRev</tt> is not updated for branch commits but only when a branch is merged.</p>
+<p>When the branch is later merged, the root node will look like this:</p>
+
+<div class="source">
+<pre>{
+    &quot;_deleted&quot; : {
+        &quot;r13fcda88ac0-0-1&quot; : &quot;false&quot;,
+    },
+    &quot;_id&quot; : &quot;0:/&quot;,
+    &quot;_lastRev&quot; : {
+        &quot;r0-0-1&quot; : &quot;r13fcda91b12-0-1&quot;
+    },
+    &quot;_modified&quot; : NumberLong(274708995),
+    &quot;_modCount&quot; : NumberLong(4),
+    &quot;_revisions&quot; : {
+        &quot;r13fcda88ac0-0-1&quot; : &quot;c&quot;,
+        &quot;r13fcda91720-0-1&quot; : &quot;c&quot;,
+       &quot;r13fcda919eb-0-1&quot; : &quot;c-r13fcda91b12-0-1&quot;
+    },
+    &quot;prop&quot; : {
+        &quot;r13fcda91720-0-1&quot; : &quot;\&quot;foo\&quot;&quot;,
+       &quot;r13fcda919eb-0-1&quot; : &quot;\&quot;bar\&quot;&quot;,
+    }
+}
+</pre></div>
+<p>Now, the changed property is visible to readers with a revision equal or newer than <tt>r13fcda91b12-0-1</tt>.</p>
+<p>The same logic is used for changes to other nodes that belong to a branch commit. MongoMK internally resolves the commit revision for a modification before it decides whether a reader is able to see a given change.</p></div>
+<div class="section">
+<h2>Previous Documents<a name="Previous_Documents"></a></h2>
+<p>Over time the size of a document grows because MongoMK adds data to the document with every modification, but never deletes anything to keep the history. Old data is moved when there are 1000 commits to be moved or the document is bigger than 1 MB. A document with a reference to old data looks like this:</p>
+
+<div class="source">
+<pre>{
+    &quot;_deleted&quot; : {
+        &quot;r13fcda88ac0-0-1&quot; : &quot;false&quot;,
+    },
+    &quot;_id&quot; : &quot;0:/&quot;,
+    &quot;_lastRev&quot; : {
+        &quot;r0-0-1&quot; : &quot;r13fcda91b12-0-1&quot;
+    },
+    &quot;_modified&quot; : NumberLong(274708995),
+    &quot;_modCount&quot; : NumberLong(1004),
+    &quot;_revisions&quot; : {
+        &quot;r13fcda88ac0-0-1&quot; : &quot;c&quot;,
+        &quot;r13fcda91720-0-1&quot; : &quot;c&quot;,
+       &quot;r13fcda919eb-0-1&quot; : &quot;c-r13fcda91b12-0-1&quot;
+    },
+    &quot;_prev&quot; : {
+        &quot;r13fcda88ae0-0-1&quot; : &quot;r13fcda91710-0-1&quot;
+    },
+    &quot;prop&quot; : {
+        &quot;r13fcda91720-0-1&quot; : &quot;\&quot;foo\&quot;&quot;,
+       &quot;r13fcda919eb-0-1&quot; : &quot;\&quot;bar\&quot;&quot;,
+    }
+}
+</pre></div>
+<p>The optional sub-document <tt>_prev</tt> contains a list of revision pairs, each indicating the range of commit revisions a previous document contains. In the above example there is one document with previous commits from <tt>r13fcda88ae0-0-1</tt> to <tt>r13fcda91710-0-1</tt>. The id of the previous document is derived from the upper bound of the range and the id/path of the current document. The id of the previous document for <tt>r13fcda88ae0-0-1</tt> and <tt>0:/</tt> is <tt>1:p/r13fcda88ae0-0-1</tt> and may looks like this:</p>
+
+<div class="source">
+<pre>{
+    &quot;_id&quot; : &quot;1:p/r13fcda88ae0-0-1&quot;,
+    &quot;_modCount&quot; : NumberLong(1),
+    &quot;_revisions&quot; : {
+        &quot;r13fcda88ae0-0-1&quot; : &quot;c&quot;,
+        &quot;r13fcda88af0-0-1&quot; : &quot;c&quot;,
+        ...  
+       &quot;r13fcda91710-0-1&quot; : &quot;c&quot;
+    },
+    &quot;prop&quot; : {
+        &quot;r13fcda88ae0-0-1&quot; : &quot;\&quot;foo\&quot;&quot;,
+        &quot;r13fcda88af0-0-1&quot; : &quot;\&quot;bar\&quot;&quot;,
+        ...
+       &quot;r13fcda91710-0-1&quot; : &quot;\&quot;baz\&quot;&quot;
+    }
+}
+</pre></div>
+<p>Previous documents only contain immutable data, which means it only contains committed and merged <tt>_revisions</tt>. This also means the previous ranges of committed data may overlap because branch commits are not moved to previous documents until the branch is merged.</p></div>
+<div class="section">
+<h2>Background Operations<a name="Background_Operations"></a></h2>
+<p>Each MongoMK instance connecting to same database in Mongo server performs certain background task.</p>
+<div class="section">
+<h3>Renew Cluster Id Lease<a name="Renew_Cluster_Id_Lease"></a></h3></div>
+<div class="section">
+<h3>Background Document Split<a name="Background_Document_Split"></a></h3>
+<p>MongoMK periodically checks documents for their size and if necessary splits them up and moves old data to a previous document. This is done in the background by each MongoMK instance for the data it created.</p></div>
+<div class="section">
+<h3>Background Writes<a name="Background_Writes"></a></h3>
+<p>While performing commits there are certain nodes which are modified but do not become part of commit. For example when a node under /a/b/c is updated then the <tt>_lastRev</tt> property of all ancestors also need to be updated to the commit revision. Such changes are accumulated and flushed periodically through a asynchronous job.</p></div>
+<div class="section">
+<h3>Background Reads<a name="Background_Reads"></a></h3>
+<p>MongoMK periodically picks up changes from other MongoMK instances by polling the root node for changes of <tt>_lastRev</tt>. This happens once every second.</p></div></div>
+<div class="section">
+<h2>Pending Topics<a name="Pending_Topics"></a></h2>
+<div class="section">
+<h3>Conflict Detection and Handling<a name="Conflict_Detection_and_Handling"></a></h3></div></div>
+<div class="section">
+<h2>License<a name="License"></a></h2>
+<p>(see the top-level <a href="../LICENSE.txt">LICENSE.txt</a> for full license details)</p>
+<p>Collective work: Copyright 2013 The Apache Software Foundation.</p>
+<p>Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the &#x201c;License&#x201d;); you may not use this file except in compliance with the License. You may obtain a copy of the License at</p>
+
+<div class="source">
+<pre> http://www.apache.org/licenses/LICENSE-2.0
+</pre></div>
+<p>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &#x201c;AS IS&#x201d; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p></div>
+                  </div>
+            </div>
+          </div>
+
+    <hr/>
+
+    <footer>
+            <div class="container-fluid">
+              <div class="row span12">Copyright &copy;                    2012-2013
+                        <a href="http://www.apache.org/">The Apache Software Foundation</a>.
+            All Rights Reserved.      
+                    
+      </div>
+
+        
+        
+          
+    
+    
+    <div id="ohloh" class="pull-right">
+      <script type="text/javascript" src="http://www.ohloh.net/p/jackrabbit-oak/widgets/project_users_logo.js"></script>
+    </div>
+        </div>
+    </footer>
+  </body>
 </html>
\ No newline at end of file



Mime
View raw message