directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1550413 - in /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed: BTree.java RecordManager.java
Date Thu, 12 Dec 2013 13:05:18 GMT
Author: elecharny
Date: Thu Dec 12 13:05:18 2013
New Revision: 1550413

URL: http://svn.apache.org/r1550413
Log:
Don't anymore update the RecordManager header when we use a free page, but do that globally,
in the insert/delete method. This save a lot of updates.

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

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/BTree.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/BTree.java?rev=1550413&r1=1550412&r2=1550413&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/BTree.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/managed/BTree.java
Thu Dec 12 13:05:18 2013
@@ -782,6 +782,9 @@ public class BTree<K, V> implements Clos
 
             recordManager.addFreePages( this, result.getCopiedPages() );
 
+            // Update the RecordManager header
+            recordManager.updateRecordManagerHeader();
+
             // Store the created rootPage into the revision BTree, this will be stored in
RecordManager only if revisions are set to keep
             recordManager.storeRootPage( this, rootPage );
 
@@ -1086,6 +1089,9 @@ public class BTree<K, V> implements Clos
         }
 
         // If the BTree is managed, we have to update the rootPage on disk
+        // Update the RecordManager header
+        recordManager.updateRecordManagerHeader();
+
         // Update the BTree header now
         recordManager.updateBtreeHeader( this, ( ( AbstractPage<K, V> ) rootPage ).getOffset()
);
 

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=1550413&r1=1550412&r2=1550413&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
Thu Dec 12 13:05:18 2013
@@ -1420,7 +1420,7 @@ public class RecordManager
     /**
      * Update the header, injecting the nbBtree, firstFreePage and lastFreePage
      */
-    private void updateRecordManagerHeader() throws IOException
+    public void updateRecordManagerHeader() throws IOException
     {
         // The page size
         HEADER_BYTES[0] = ( byte ) ( pageSize >>> 24 );
@@ -2067,9 +2067,6 @@ public class RecordManager
                 lastFreePage = NO_PAGE;
             }
 
-            // Update the header
-            updateRecordManagerHeader();
-
             return pageIo;
         }
     }
@@ -2445,9 +2442,6 @@ public class RecordManager
                     firstFreePage = firstOffset;
                 }
             }
-
-            // Last, not least, flush the header
-            updateRecordManagerHeader();
         }
         else
         {



Mime
View raw message