directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r888410 - in /websites/staging/directory/trunk/content: ./ mavibot/user-guide.html mavibot/user-guide/7.3-serializations.html
Date Thu, 28 Nov 2013 17:54:01 GMT
Author: buildbot
Date: Thu Nov 28 17:54:01 2013
New Revision: 888410

Log:
Staging update by buildbot for directory

Modified:
    websites/staging/directory/trunk/content/   (props changed)
    websites/staging/directory/trunk/content/mavibot/user-guide.html
    websites/staging/directory/trunk/content/mavibot/user-guide/7.3-serializations.html

Propchange: websites/staging/directory/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Nov 28 17:54:01 2013
@@ -1 +1 @@
-1545228
+1546410

Modified: websites/staging/directory/trunk/content/mavibot/user-guide.html
==============================================================================
--- websites/staging/directory/trunk/content/mavibot/user-guide.html (original)
+++ websites/staging/directory/trunk/content/mavibot/user-guide.html Thu Nov 28 17:54:01 2013
@@ -207,6 +207,7 @@
 <ul>
 <li><a href="user-guide/7.1-logical-structure.html">7.1 - Logical Structure</a></li>
 <li><a href="user-guide/7.1-physical-structure.html">7.2 - Physical Structure</a></li>
+<li><a href="user-guide/7.3-serializations.html">7.3 - Serializations</a></li>
 </ul>
 </li>
 </ul>

Modified: websites/staging/directory/trunk/content/mavibot/user-guide/7.3-serializations.html
==============================================================================
--- websites/staging/directory/trunk/content/mavibot/user-guide/7.3-serializations.html (original)
+++ websites/staging/directory/trunk/content/mavibot/user-guide/7.3-serializations.html Thu
Nov 28 17:54:01 2013
@@ -225,7 +225,7 @@ public class KeyHolder<K>
 <h5 id="getraw">getRaw()</h5>
 <p>Returns the <em>raw</em> field. This method is only visible from the
classes in the same package.</p>
 <h3 id="valueholder">ValueHolder</h3>
-<p>The <em>ValueHolder</em> data structure will store the list of values
associated with a key. As we may have more than one value, we use an internal structure for
that purpose.</p>
+<p>The <em>ValueHolder</em> data structure will store the list of values
associated with a key. As we may have more than one value, we use an internal structure for
that purpose. This is a complex data structure, if we compare it with the <em>KeyHolder</em>
one.</p>
 <p>In some case, the number of values to store is really big, this we need to use an
internal data structure that allows a quick retrieval of a value, plus we need to be able
to copy a page containing such a value in an efficient way. For these reasons, we use two
different internal data structures :
 <em> an array up to a threshold
 </em> a sub-BTree above this threshold</p>
@@ -239,6 +239,49 @@ public class KeyHolder<K>
 </pre>
 
 <p>It's important to know that the sub-BTree will hold only keys, and no values. The
sub-btree Keys will be the values we have to store.</p>
+<p>Here is the description of this class :</p>
+<pre>
+public class ValueHolder<V> implements Cloneable
+{
+    /** The deserialized value */
+    private V[] valueArray;
+
+    /** The BTree storing multiple value, if we have moe than a threashold values */
+    private BTree<V, V> valueBtree;
+
+    /** The serialized value */
+    private byte[] raw;
+
+    /** A flag set to true if the values are stored in a BTree */
+    private boolean isSubBtree = false;
+
+    /** The RecordManager */
+    private BTree<?, V> btree;
+
+    /** The Value serializer */
+    private ElementSerializer<V> valueSerializer;
+
+    /** An internal flag used when the values are not yet deserialized */
+    private boolean isRaw = true;
+}
+</pre>
+
+<p>As we can see, we use two different fields to store the data, either the <em>valueArray</em>
field or the <em>valueBtree</em> field. The <em>raw</em> field contains
the serialized values when the values are stored in an array; It's null either if the values
are stored in a BTree, or if we already have deserialized the values.</p>
+<h4 id="rawdeserialized-values">Raw/deserialized values</h4>
+<p>One key for obtaining good performances is to avoid any useless deserialization.
This is easy to implement for the <em>KeyHolder</em>, as we only store one single
key. For values, it's slightly more complex, as we may have more than one value. The following
rules should be followed :</p>
+<ul>
+<li>don't deserialized until necessary (ie, when one need to get one value)</li>
+<li>don't serialize when unnedded (ie until the values must be written back to disk)</li>
+</ul>
+<p>In fact, we may be in three different states :</p>
+<ul>
+<li>all the values are serialized (when we just read the page from disk)</li>
+<li>non of the values are serialized (when we just created a ValueHolder with new values)</li>
+<li>somewhere in the middle, when we are modifying a ValueHolder which has been read
from the disk</li>
+</ul>
+<p>The third case is the complex one. We should consider two different cases though
:
+<em> the values are stored in a sub BTree : we don't have to deal with this problem,
it's up to the sub-btree to deal with it
+</em> the values are stored in an array : we don't want to store half of the values
as byte[], and half of the values as java instances. We must pick either one form or the other.
In this case, as soon as we have to manipulate values in Java, then we need to deserialize
all the values.</p>
 <h4 id="valueholder-operations">ValueHolder operations</h4>
 <p>The possible operations on a ValueHolder are the following :</p>
 <ul>
@@ -249,6 +292,7 @@ public class KeyHolder<K>
 <pre>
   if the values are not yet deserialized
     then deserialize all the values
+</pre>
 
 
     <div class="nav">



Mime
View raw message