directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1662242 - in /directory/mavibot/trunk/mavibot/src: main/java/org/apache/directory/mavibot/btree/ test/java/org/apache/directory/mavibot/btree/
Date Wed, 25 Feb 2015 15:19:57 GMT
Author: elecharny
Date: Wed Feb 25 15:19:55 2015
New Revision: 1662242

URL: http://svn.apache.org/r1662242
Log:
o A few optimization in the browse(K) method
o Fixed a NPE (DIRSERVER-20147) applying Lin's suggested patch
o Removed some spurious Sysout.println

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/PersistedLeaf.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BulkLoaderTest.java
    directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java?rev=1662242&r1=1662241&r2=1662242&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/AbstractBTree.java
Wed Feb 25 15:19:55 2015
@@ -191,10 +191,9 @@ import org.apache.directory.mavibot.btre
 
         ParentPos<K, V>[] stack = ( ParentPos<K, V>[] ) Array.newInstance( ParentPos.class,
32 );
 
-        TupleCursor<K, V> cursor;
         try
         {
-            cursor = getRootPage( transaction.getRevision() ).browse( key, transaction, stack,
0 );
+            TupleCursor<K, V> cursor = getRootPage( transaction.getRevision() ).browse(
key, transaction, stack, 0 );
 
             return cursor;
         }

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=1662242&r1=1662241&r2=1662242&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 Feb 25 15:19:55 2015
@@ -782,7 +782,7 @@ import org.apache.directory.mavibot.btre
 
                 stack[depth] = parentPos;
             }
-            else if ( nbElems >= 0 )
+            else
             {
                 // We are at the end of a leaf. We have to check if we are at the end 
                 // of the tree or not
@@ -795,10 +795,9 @@ import org.apache.directory.mavibot.btre
                     {
                         cursor.afterLast();
                     }
-                    catch ( IOException e )
+                    catch ( IOException ioe )
                     {
-                        // TODO Auto-generated catch block
-                        e.printStackTrace();
+                        // Not likely to happen
                     }
                 }
                 else
@@ -830,13 +829,6 @@ import org.apache.directory.mavibot.btre
                     }
                 }
             }
-            else
-            {
-                // Not found, because there are no elements : return a null cursor
-                stack[depth] = null;
-
-                cursor = new TupleCursor<K, V>( transaction, null, 0 );
-            }
         }
 
         return cursor;

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java?rev=1662242&r1=1662241&r2=1662242&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/TupleCursor.java
Wed Feb 25 15:19:55 2015
@@ -226,8 +226,9 @@ public class TupleCursor<K, V>
         else
         {
             // Check if we have some more value
-            if ( parentPos.valueCursor.hasNext() )
+            if ( ( parentPos.valueCursor != null ) && parentPos.valueCursor.hasNext()
)
             {
+                // No problem, we still have some values to read
                 return true;
             }
 

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BulkLoaderTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BulkLoaderTest.java?rev=1662242&r1=1662241&r2=1662242&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BulkLoaderTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/BulkLoaderTest.java
Wed Feb 25 15:19:55 2015
@@ -365,7 +365,7 @@ public class BulkLoaderTest
 
             //System.out.println( "Delta initial load = " + ( t3 - t2 ) );
 
-            System.out.println( "Checking for N = " + n );
+            //System.out.println( "Checking for N = " + n );
             checkBtree( btree, newBtree );
         }
     }
@@ -400,7 +400,7 @@ public class BulkLoaderTest
 
         //System.out.println( "Delta initial load = " + ( t3 - t2 ) );
 
-        System.out.println( "Checking for N = " + 21 );
+        //System.out.println( "Checking for N = " + 21 );
         checkBtree( btree, newBtree );
     }
 
@@ -559,11 +559,6 @@ public class BulkLoaderTest
             for ( int i = 2599; i <= 2599; i++ )
             {
                 List<LevelInfo<Long, String>> levels = BulkLoader.computeLevels(
btree, i );
-
-                for ( LevelInfo<Long, String> level : levels )
-                {
-                    System.out.println( level );
-                }
             }
         }
         finally
@@ -769,9 +764,6 @@ public class BulkLoaderTest
             result = BulkLoader.load( btree, tupleIterator, 128 );
             long t1 = System.currentTimeMillis();
 
-            System.out.println( "== Btree #" + 4 + ", Time to bulkoad the " + nbElems + "
elements "
-                + ( t1 - t0 ) + "ms" );
-
             TupleCursor<Long, String> cursor = result.browse();
             int nbFetched = 0;
 
@@ -1179,7 +1171,6 @@ public class BulkLoaderTest
                     prev = elem;
                     elem = cursor.next();
                     nbFetched++;
-                    System.out.println( elem );
                 }
             }
             catch ( Exception e )

Modified: directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java?rev=1662242&r1=1662241&r2=1662242&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
(original)
+++ directory/mavibot/trunk/mavibot/src/test/java/org/apache/directory/mavibot/btree/RecordManagerTest.java
Wed Feb 25 15:19:55 2015
@@ -69,8 +69,6 @@ public class RecordManagerTest
     {
         dataDir = tempFolder.newFolder( UUID.randomUUID().toString() );
 
-        System.out.println( dataDir + "/mavibot.db" );
-
         openRecordManagerAndBtree();
 
         try



Mime
View raw message