directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1663834 - in /directory/mavibot/trunk/mavibot/src: main/java/org/apache/directory/mavibot/btree/ test/java/org/apache/directory/mavibot/btree/
Date Wed, 04 Mar 2015 00:54:41 GMT
Author: elecharny
Date: Wed Mar  4 00:54:41 2015
New Revision: 1663834

URL: http://svn.apache.org/r1663834
Log:
o Set the caseSize to DEFAULT_CACHE_SIZE if it's 0
o Suppressed some useless code in the browsefrom method

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java?rev=1663834&r1=1663833&r2=1663834&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedBTree.java
Wed Mar  4 00:54:41 2015
@@ -164,7 +164,7 @@ public class PersistedBTree<K, V> extend
 
             if ( cacheSize < 1 )
             {
-                cacheSize = 1;
+                cacheSize = DEFAULT_CACHE_SIZE;
             }
 
             cache = new LRUMap( cacheSize );

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java?rev=1663834&r1=1663833&r2=1663834&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java
Wed Mar  4 00:54:41 2015
@@ -842,27 +842,8 @@ import org.apache.directory.mavibot.btre
 
                         return cursor;
                     }
-                    else
-                    {
-                        // go down the tree again, but one position to the right
-                        stack[stackIndex].pos++;
 
-                        for ( int i = stackIndex + 1; i < depth - 1; i++ )
-                        {
-                            ParentPos<K, V> parentPos = new ParentPos<K, V>(
this, 0 );
-
-                            stack[i] = parentPos;
-                        }
-
-                        ParentPos<K, V> parentPos = new ParentPos<K, V>( this,
0 );
-
-                        // Create the value cursor
-                        parentPos.valueCursor = values[0].getCursor();
-
-                        stack[depth - 1] = parentPos;
-
-                        return cursor;
-                    }
+                    return cursor;
                 }
             }
         }

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java?rev=1663834&r1=1663833&r2=1663834&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/PersistedBTreeBrowseTest.java
Wed Mar  4 00:54:41 2015
@@ -1180,6 +1180,8 @@ public class PersistedBTreeBrowseTest
         {
             btreeLong = recordManager1.addBTree( "testLong", LongSerializer.INSTANCE, LongSerializer.INSTANCE,
true );
 
+            // Create a set of 500 values from 0 to 499, in a random order
+            // (all the values are there, they are just shuffled)
             int nbKeys = 500;
             List<Long> values = new ArrayList<Long>( nbKeys );
             long[] randomVals = new long[nbKeys];
@@ -1209,7 +1211,7 @@ public class PersistedBTreeBrowseTest
 
             int nbValues = 9;
 
-            // Inject some data
+            // Inject the 500 keys, each of them with 10 values
             for ( int i = 0; i < nbKeys; i++ )
             {
                 Long value = randomVals[i];
@@ -1222,11 +1224,12 @@ public class PersistedBTreeBrowseTest
 
             long t0 = System.currentTimeMillis();
 
-            // Now, browse the BTree starting from 0 to the end
+            // Now, browse the BTree fully, as many time as we have keys.
+            // We always browse from a different position, we should cover all
+            // the possible situations.
             for ( Long i = 0L; i < nbKeys; i++ )
             {
-                //System.out.println( "Browsing from " + i );
-                // Create the cursor
+                // Create the cursor, positionning it before the key
                 TupleCursor<Long, Long> cursor = btreeLong.browseFrom( i );
 
                 assertTrue( cursor.hasNext() );
@@ -1253,7 +1256,7 @@ public class PersistedBTreeBrowseTest
 
             long t00 = System.currentTimeMillis();
 
-            // Now, browse the BTree starting from 0 to the end
+            // Now, browse the BTree backward
             for ( Long i = nbKeys - 1L; i >= 0; i-- )
             {
                 // Create the cursor



Mime
View raw message