directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1546505 - in /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed: RecordManager.java ValueHolder.java
Date Fri, 29 Nov 2013 03:40:07 GMT
Author: elecharny
Date: Fri Nov 29 03:40:06 2013
New Revision: 1546505

URL: http://svn.apache.org/r1546505
Log:
Don't store the sub-btree into the managedBTrees Map, so they aren't stored in memory for
ever even when a page is discarded

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/RecordManager.java
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/ValueHolder.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/RecordManager.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/RecordManager.java?rev=1546505&r1=1546504&r2=1546505&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/RecordManager.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/RecordManager.java
Fri Nov 29 03:40:06 2013
@@ -159,6 +159,12 @@ public class RecordManager
 
     /** A flag set to true if we want to keep old revisions */
     private boolean keepRevisions;
+    
+    /** A flag used by internal btrees */
+    public static final boolean INTERNAL_BTREE = true;
+    
+    /** A flag used by internal btrees */
+    public static final boolean NORMAL_BTREE = false;
 
 
     /**
@@ -970,7 +976,7 @@ public class RecordManager
      */
     public synchronized <K, V> void manage( BTree<K, V> btree ) throws BTreeAlreadyManagedException,
IOException
     {
-        manage( ( BTree<Object, Object> ) btree, false );
+        manage( ( BTree<Object, Object> ) btree, NORMAL_BTREE );
     }
 
 
@@ -1000,7 +1006,12 @@ public class RecordManager
             throw new BTreeAlreadyManagedException( name );
         }
 
-        managedBTrees.put( name, ( BTree<Object, Object> ) btree );
+        // Do not add the BTree if it's internal into the Map of managed btrees, otherwise
we will 
+        // not discard it when reloading a page wth internal btrees
+        if ( !internalTree )
+        {
+            managedBTrees.put( name, ( BTree<Object, Object> ) btree );
+        } 
 
         // We will add the newly managed BTree at the end of the header.
         byte[] btreeNameBytes = Strings.getBytesUtf8( name );

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/ValueHolder.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/ValueHolder.java?rev=1546505&r1=1546504&r2=1546505&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/ValueHolder.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/ValueHolder.java
Fri Nov 29 03:40:06 2013
@@ -609,7 +609,7 @@ public class ValueHolder<V> implements C
 
             try
             {
-                btree.getRecordManager().manage( valueBtree, true );
+                btree.getRecordManager().manage( valueBtree, RecordManager.INTERNAL_BTREE
);
                 raw = null;
             }
             catch ( BTreeAlreadyManagedException e )



Mime
View raw message