directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1593034 - /directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
Date Wed, 07 May 2014 15:11:52 GMT
Author: elecharny
Date: Wed May  7 15:11:51 2014
New Revision: 1593034

URL: http://svn.apache.org/r1593034
Log:
Added the code to check the CopiedPages b-tree. We now are checking the full file, except
the sub-btrees.

Modified:
    directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java

Modified: directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
URL: http://svn.apache.org/viewvc/directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java?rev=1593034&r1=1593033&r2=1593034&view=diff
==============================================================================
--- directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
(original)
+++ directory/mavibot/branches/with-txns/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
Wed May  7 15:11:51 2014
@@ -341,58 +341,9 @@ public class MavibotInspector
             checkBtreeOfBtrees( recordManager, checkedPages );
 
             // And the Copied Pages BTree
-            //checkCopiedPagesBtree( recordManager, checkedPages );
+            checkBtree( recordManager, currentCopiedPagesBtreeOffset, checkedPages );
 
-            /*
-            // The B-trees
-            ///////////////////////
-            // Now, read all the B-trees from the btree of btrees
-            TupleCursor<NameRevision, Long> btreeCursor = btreeOfBtrees.browse();
-            Map<String, Long> loadedBtrees = new HashMap<String, Long>();
-
-            // loop on all the btrees we have, and keep only the latest revision
-            long currentRevision = -1L;
-
-            while ( btreeCursor.hasNext() )
-            {
-                Tuple<NameRevision, Long> btreeTuple = btreeCursor.next();
-                NameRevision nameRevision = btreeTuple.getKey();
-                long btreeOffset = btreeTuple.getValue();
-                long revision = nameRevision.getValue();
-
-                // Check if we already have processed this B-tree
-                Long loadedBtreeRevision = loadedBtrees.get( nameRevision.getName() );
-
-                if ( loadedBtreeRevision != null )
-                {
-                    // The btree has already been loaded. The revision is necessarily higher
-                    if ( revision > currentRevision )
-                    {
-                        // We have a newer revision : switch to the new revision (we keep
the offset atm)
-                        loadedBtrees.put( nameRevision.getName(), btreeOffset );
-                        currentRevision = revision;
-                    }
-                }
-                else
-                {
-                    // This is a new B-tree
-                    loadedBtrees.put( nameRevision.getName(), btreeOffset );
-                    currentRevision = nameRevision.getRevision();
-                }
-            }
-
-            // check the btrees
-            for ( String btreeName : loadedBtrees.keySet() )
-            {
-                long btreeOffset = loadedBtrees.get( btreeName );
-
-                PageIO[] btreePageIos = recordManager.readPageIOs( btreeOffset, Long.MAX_VALUE
);
-                checkBtree( recordManager, checkedPages, btreePageIos );
-            }
-
-            //////////////////////
-            */
-            
+            // We can now dump the checked pages
             dumpCheckedPages( recordManager, checkedPages );
         }
         catch ( Exception e )
@@ -539,21 +490,6 @@ public class MavibotInspector
 
     
     /**
-     * Check the Copied pages Btree
-     */
-    private static void checkCopiedPagesBtree( RecordManager recordManager, int[] checkedPages
) throws EndOfFileExceededException, IOException
-    {
-        // Read the CPB header
-        PageIO[] cpbHeaderPageIos = recordManager.readPageIOs( recordManager.currentCopiedPagesBtreeOffset,
Long.MAX_VALUE );
-
-        // update the checkedPages
-        updateCheckedPages( checkedPages, recordManager.pageSize, cpbHeaderPageIos );
-
-        //checkBtree( recordManager, checkedPages, pageSize, bobHeaderPageIos );
-    }
-    
-
-    /**
      * Check the Btree info page
      * @throws ClassNotFoundException 
      */
@@ -603,7 +539,7 @@ public class MavibotInspector
         dataPos += RecordManager.INT_SIZE;
 
         // update the checkedPages
-        if ( btreeRevision != -1L )
+        if ( !RecordManager.COPIED_PAGE_BTREE_NAME.equals( btreeName ) && !RecordManager.BTREE_OF_BTREES_NAME.equals(
btreeName ) )
         {
             btreeName = btreeName + "<" + btreeRevision + ">";
         }
@@ -909,6 +845,10 @@ public class MavibotInspector
                 children[i] = firstOffset;
                 
                 // Now, read the key
+                // The key lenth
+                byteBuffer.getInt();
+                
+                // The key itself
                 btreeInfo.keySerializer.deserialize( byteBuffer );
 
             }
@@ -1354,10 +1294,10 @@ final class BtreeInfo<K, V>
     {
         StringBuilder sb = new StringBuilder();
         
-        sb.append( "B-tree Info : \n" );
-        sb.append( "    name              : " ).append( btreeName );
-        sb.append( "    key serializer    : " ).append( keySerializer.getClass().getName()
);
-        sb.append( "    value serializer  : " ).append( valueSerializer.getClass().getName()
);
+        sb.append( "B-tree Info :" );
+        sb.append( "\n    name              : " ).append( btreeName );
+        sb.append( "\n    key serializer    : " ).append( keySerializer.getClass().getName()
);
+        sb.append( "\n    value serializer  : " ).append( valueSerializer.getClass().getName()
);
         
         return sb.toString();
     }



Mime
View raw message