directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kayyag...@apache.org
Subject svn commit: r1681725 - /directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
Date Tue, 26 May 2015 09:10:50 GMT
Author: kayyagari
Date: Tue May 26 09:10:49 2015
New Revision: 1681725

URL: http://svn.apache.org/r1681725
Log:
o replaced duplicate code from updateCheckedPages() with a call to  setCheckedPage()
o fixed incorrect offset calculation in getPageOffsets()

Modified:
    directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java

Modified: directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
URL: http://svn.apache.org/viewvc/directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java?rev=1681725&r1=1681724&r2=1681725&view=diff
==============================================================================
--- directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
(original)
+++ directory/mavibot/trunk/mavibot/src/main/java/org/apache/directory/mavibot/btree/MavibotInspector.java
Tue May 26 09:10:49 2015
@@ -946,23 +946,7 @@ public class MavibotInspector
         {
             long offset = pageIO.getOffset();
 
-            if ( ( offset % pageSize ) != 0 )
-            {
-                throw new InvalidBTreeException( "Offset invalid : " + offset );
-            }
-
-            int pageNumber = ( int ) ( offset / pageSize );
-            int nbBitsPage = ( RecordManager.INT_SIZE << 3 );
-            int pageMask = checkedPages[pageNumber / nbBitsPage];
-            int mask = 1 << pageNumber % nbBitsPage;
-
-            if ( ( pageMask & mask ) != 0 )
-            {
-                //throw new InvalidBTreeException( "The page " + offset + " has already been
referenced" );
-            }
-
-            pageMask |= mask;
-            checkedPages[pageNumber / nbBitsPage] = pageMask;
+            setCheckedPage( rm, checkedPages, offset );
         }
     }
 
@@ -1140,7 +1124,7 @@ public class MavibotInspector
         
         int[] fparry = checkedPages.get( pageArrayName );
 
-        long nbPagesChecked = 0;
+        long nbPagesChecked = 0; // the 0th page will always be of RM header
         long fileSize = rm.fileChannel.size();
         long nbPages = ( fileSize - RecordManager.RECORD_MANAGER_HEADER_SIZE ) / rm.pageSize;
 
@@ -1148,7 +1132,6 @@ public class MavibotInspector
         {
             for ( int j = 0; j < 32; j++ )
             {
-                nbPagesChecked++;
 
                 if ( nbPagesChecked > nbPages + 1 )
                 {
@@ -1162,6 +1145,8 @@ public class MavibotInspector
                         lst.add( nbPagesChecked * rm.pageSize);
                     }
                 }
+                
+                nbPagesChecked++;
             }
         }
         



Mime
View raw message