directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1435201 - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ protocol-ldap/src/test/java...
Date Fri, 18 Jan 2013 15:49:27 GMT
Author: elecharny
Date: Fri Jan 18 15:49:27 2013
New Revision: 1435201

URL: http://svn.apache.org/viewvc?rev=1435201&view=rev
Log:
Added a transactionManager for every opened BTree

Modified:
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLog.java
    directory/apacheds/trunk/protocol-ldap/src/test/java/org/apache/directory/server/ldap/JournalTest.java

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/DupsContainerCursor.java
Fri Jan 18 15:49:27 2013
@@ -121,7 +121,6 @@ public class DupsContainerCursor<K, V> e
     public void beforeKey( K key ) throws LdapException, CursorException, IOException
     {
         checkNotClosed( "beforeKey()" );
-        this.closeBrowser( browser );
         browser = ( ( BTree<K, V> ) table.getBTree() ).browse( key );
         forwardDirection = null;
         clearValue();
@@ -136,7 +135,6 @@ public class DupsContainerCursor<K, V> e
     {
         checkNotClosed( "afterKey()" );
 
-        this.closeBrowser( browser );
         browser = ( ( BTree<K, V> ) table.getBTree() ).browse( key );
         forwardDirection = null;
 
@@ -219,7 +217,6 @@ public class DupsContainerCursor<K, V> e
     public void beforeFirst() throws LdapException, CursorException, IOException
     {
         checkNotClosed( "beforeFirst()" );
-        this.closeBrowser( browser );
         browser = table.getBTree().browse();
         forwardDirection = null;
         clearValue();
@@ -233,7 +230,6 @@ public class DupsContainerCursor<K, V> e
     public void afterLast() throws LdapException, CursorException, IOException
     {
         checkNotClosed( "afterLast()" );
-        this.closeBrowser( browser );
         browser = table.getBTree().browse( null );
         forwardDirection = null;
         clearValue();
@@ -395,9 +391,8 @@ public class DupsContainerCursor<K, V> e
         {
             LOG_CURSOR.debug( "Closing DupsContainerCursor {}", this );
         }
-        
+
         super.close();
-        closeBrowser( browser );
     }
 
 
@@ -411,17 +406,7 @@ public class DupsContainerCursor<K, V> e
         {
             LOG_CURSOR.debug( "Closing DupsContainerCursor {}", this );
         }
-        
-        super.close( cause );
-        closeBrowser( browser );
-    }
-
 
-    private void closeBrowser( TupleBrowser browser )
-    {
-        if ( browser != null )
-        {
-            browser.close();
-        }
+        super.close( cause );
     }
 }

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmIndex.java
Fri Jan 18 15:49:27 2013
@@ -30,12 +30,12 @@ import jdbm.helper.ByteArraySerializer;
 import jdbm.helper.MRU;
 import jdbm.recman.BaseRecordManager;
 import jdbm.recman.CacheRecordManager;
+import jdbm.recman.TransactionManager;
 
 import org.apache.directory.api.ldap.model.cursor.Cursor;
 import org.apache.directory.api.ldap.model.cursor.EmptyCursor;
 import org.apache.directory.api.ldap.model.cursor.Tuple;
 import org.apache.directory.api.ldap.model.exception.LdapException;
-import org.apache.directory.api.ldap.model.exception.LdapOtherException;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
 import org.apache.directory.api.ldap.model.schema.MatchingRule;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
@@ -161,6 +161,9 @@ public class JdbmIndex<K, V> extends Abs
         String path = new File( this.wkDirPath, attributeType.getOid() ).getAbsolutePath();
 
         BaseRecordManager base = new BaseRecordManager( path );
+        TransactionManager transactionManager = base.getTransactionManager();
+        transactionManager.setMaximumTransactionsInLog( 200 );
+
         recMan = new CacheRecordManager( base, new MRU( DEFAULT_INDEX_CACHE_SIZE ) );
 
         try

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.java
Fri Jan 18 15:49:27 2013
@@ -33,6 +33,7 @@ import jdbm.RecordManager;
 import jdbm.helper.MRU;
 import jdbm.recman.BaseRecordManager;
 import jdbm.recman.CacheRecordManager;
+import jdbm.recman.TransactionManager;
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.Element;
 
@@ -101,6 +102,7 @@ public class JdbmPartition extends Abstr
     /** the entry cache */
     private Cache entryCache;
 
+
     /**
      * Creates a store based on JDBM B+Trees.
      */
@@ -154,7 +156,8 @@ public class JdbmPartition extends Abstr
             String path = partitionDir.getPath() + File.separator + "master";
 
             BaseRecordManager base = new BaseRecordManager( path );
-            base.disableTransactions();
+            TransactionManager transactionManager = base.getTransactionManager();
+            transactionManager.setMaximumTransactionsInLog( 200 );
 
             if ( cacheSize < 0 )
             {
@@ -261,11 +264,11 @@ public class JdbmPartition extends Abstr
                 }
             }
 
-            if( cacheService != null )
+            if ( cacheService != null )
             {
                 entryCache = cacheService.getCache( getId() );
             }
-            
+
             // We are done !
             initialized = true;
         }
@@ -483,12 +486,12 @@ public class JdbmPartition extends Abstr
         }
         finally
         {
-            if( entryCache != null )
+            if ( entryCache != null )
             {
                 entryCache.removeAll();
             }
         }
-        
+
         if ( errors.size() > 0 )
         {
             throw errors;
@@ -526,42 +529,42 @@ public class JdbmPartition extends Abstr
     @Override
     public void updateCache( OperationContext opCtx )
     {
-        if( entryCache == null )
+        if ( entryCache == null )
         {
             return;
         }
-        
+
         try
         {
-            if( opCtx instanceof ModifyOperationContext )
+            if ( opCtx instanceof ModifyOperationContext )
             {
                 // replace the entry
                 ModifyOperationContext modCtx = ( ModifyOperationContext ) opCtx;
                 Entry entry = modCtx.getAlteredEntry();
                 String id = entry.get( SchemaConstants.ENTRY_UUID_AT ).getString();
-                
-                if( entry instanceof ClonedServerEntry )
+
+                if ( entry instanceof ClonedServerEntry )
                 {
                     entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
                 }
-                
+
                 entryCache.replace( new Element( id, entry ) );
             }
-            else if( ( opCtx instanceof MoveOperationContext ) ||
+            else if ( ( opCtx instanceof MoveOperationContext ) ||
                 ( opCtx instanceof MoveAndRenameOperationContext ) ||
                 ( opCtx instanceof RenameOperationContext ) )
             {
                 // clear the cache it is not worth updating all the children
                 entryCache.removeAll();
             }
-            else if( opCtx instanceof DeleteOperationContext )
+            else if ( opCtx instanceof DeleteOperationContext )
             {
                 // delete the entry
                 DeleteOperationContext delCtx = ( DeleteOperationContext ) opCtx;
                 entryCache.remove( delCtx.getEntry().get( SchemaConstants.ENTRY_UUID_AT ).getString()
);
             }
         }
-        catch( LdapException e )
+        catch ( LdapException e )
         {
             LOG.warn( "Failed to update entry cache", e );
         }
@@ -571,18 +574,18 @@ public class JdbmPartition extends Abstr
     @Override
     public Entry lookupCache( String id )
     {
-        if( entryCache == null )
+        if ( entryCache == null )
         {
             return null;
         }
 
         Element el = entryCache.get( id );
-        
-        if( el != null )
+
+        if ( el != null )
         {
             return ( Entry ) el.getValue();
         }
-        
+
         return null;
     }
 
@@ -590,17 +593,17 @@ public class JdbmPartition extends Abstr
     @Override
     public void addToCache( String id, Entry entry )
     {
-        if( entryCache == null )
+        if ( entryCache == null )
         {
             return;
         }
 
-        if( entry instanceof ClonedServerEntry )
+        if ( entry instanceof ClonedServerEntry )
         {
             entry = ( ( ClonedServerEntry ) entry ).getOriginalEntry();
         }
-        
+
         entryCache.put( new Element( id, entry ) );
     }
-    
+
 }

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmRdnIndex.java
Fri Jan 18 15:49:27 2013
@@ -30,6 +30,7 @@ import javax.naming.NamingException;
 import jdbm.helper.MRU;
 import jdbm.recman.BaseRecordManager;
 import jdbm.recman.CacheRecordManager;
+import jdbm.recman.TransactionManager;
 
 import org.apache.directory.api.ldap.model.entry.Entry;
 import org.apache.directory.api.ldap.model.schema.AttributeType;
@@ -86,7 +87,9 @@ public class JdbmRdnIndex extends JdbmIn
 
         //System.out.println( "IDX Created index " + path )
         BaseRecordManager base = new BaseRecordManager( path );
-        base.disableTransactions();
+        TransactionManager transactionManager = base.getTransactionManager();
+        transactionManager.setMaximumTransactionsInLog( 200 );
+
         recMan = new CacheRecordManager( base, new MRU( cacheSize ) );
 
         try

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmTable.java
Fri Jan 18 15:49:27 2013
@@ -275,7 +275,7 @@ public class JdbmTable<K, V> extends Abs
         }
 
         try
-        {      
+        {
             if ( !allowsDuplicates )
             {
                 if ( null == bt.find( key ) )
@@ -287,14 +287,14 @@ public class JdbmTable<K, V> extends Abs
                     return 1;
                 }
             }
-    
+
             DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-    
+
             if ( values.isArrayTree() )
             {
                 return values.getArrayTree().size();
             }
-    
+
             return getBTree( values.getBTreeRedirect() ).size();
         }
         catch ( IOException ioe )
@@ -322,30 +322,28 @@ public class JdbmTable<K, V> extends Abs
             {
                 return bt.find( key );
             }
-    
+
             DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-    
+
             if ( values.isArrayTree() )
             {
                 ArrayTree<V> set = values.getArrayTree();
-    
+
                 if ( set.getFirst() == null )
                 {
                     return null;
                 }
-    
+
                 return set.getFirst();
             }
-    
+
             // Handle values if they are stored in another BTree
             BTree tree = getBTree( values.getBTreeRedirect() );
-    
+
             jdbm.helper.Tuple tuple = new jdbm.helper.Tuple();
             TupleBrowser<K, V> browser = tree.browse();
             browser.getNext( tuple );
-            this.closeBrowser( browser );
-            //noinspection unchecked
-    
+
             return ( V ) tuple.getKey();
         }
         catch ( IOException ioe )
@@ -374,17 +372,17 @@ public class JdbmTable<K, V> extends Abs
         try
         {
             DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-    
+
             if ( values.isArrayTree() )
             {
                 ArrayTree<V> set = values.getArrayTree();
                 V result = set.findGreaterOrEqual( val );
                 return result != null;
             }
-    
+
             // last option is to try a btree with BTreeRedirects
             BTree<K, V> tree = getBTree( values.getBTreeRedirect() );
-    
+
             return tree.size() != 0 && btreeHas( tree, val, true );
         }
         catch ( IOException ioe )
@@ -412,17 +410,17 @@ public class JdbmTable<K, V> extends Abs
         try
         {
             DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-    
+
             if ( values.isArrayTree() )
             {
                 ArrayTree<V> set = values.getArrayTree();
                 V result = set.findLessOrEqual( val );
                 return result != null;
             }
-    
+
             // last option is to try a btree with BTreeRedirects
             BTree<K, V> tree = getBTree( values.getBTreeRedirect() );
-    
+
             return tree.size() != 0 && btreeHas( tree, val, false );
         }
         catch ( IOException ioe )
@@ -499,11 +497,8 @@ public class JdbmTable<K, V> extends Abs
 
             if ( browser.getPrevious( tuple ) )
             {
-                this.closeBrowser( browser );
                 return true;
             }
-
-            this.closeBrowser( browser );
         }
 
         return false;
@@ -531,12 +526,12 @@ public class JdbmTable<K, V> extends Abs
             }
 
             DupsContainer<V> values = getDupsContainer( ( byte[] ) bt.find( key ) );
-    
+
             if ( values.isArrayTree() )
             {
                 return values.getArrayTree().find( value ) != null;
             }
-    
+
             return getBTree( values.getBTreeRedirect() ).find( value ) != null;
         }
         catch ( IOException ioe )
@@ -590,6 +585,8 @@ public class JdbmTable<K, V> extends Abs
                     LOG.debug( "<--- Add ONE {} = {}", name, key );
                 }
 
+                recMan.commit();
+
                 return;
             }
 
@@ -627,6 +624,8 @@ public class JdbmTable<K, V> extends Abs
                 }
 
                 count++;
+                recMan.commit();
+
                 return;
             }
 
@@ -642,6 +641,8 @@ public class JdbmTable<K, V> extends Abs
             {
                 LOG.debug( "<--- Add BTREE {} = {}", name, key );
             }
+
+            recMan.commit();
         }
         catch ( Exception e )
         {
@@ -690,6 +691,8 @@ public class JdbmTable<K, V> extends Abs
                         LOG.debug( "<--- Remove ONE " + name + " = " + key + ", " + value
);
                     }
 
+                    recMan.commit();
+
                     return;
                 }
 
@@ -721,6 +724,8 @@ public class JdbmTable<K, V> extends Abs
                         LOG.debug( "<--- Remove AVL " + name + " = " + key + ", " + value
);
                     }
 
+                    recMan.commit();
+
                     return;
                 }
 
@@ -750,6 +755,8 @@ public class JdbmTable<K, V> extends Abs
                     LOG.debug( "<--- Remove BTREE " + name + " = " + key + ", " + value
);
                 }
 
+                recMan.commit();
+
                 return;
             }
         }
@@ -798,6 +805,8 @@ public class JdbmTable<K, V> extends Abs
                     LOG.debug( "<--- Remove ONE {} = {}", name, key );
                 }
 
+                recMan.commit();
+
                 return;
             }
 
@@ -816,6 +825,8 @@ public class JdbmTable<K, V> extends Abs
                 recMan.delete( tree.getRecordId() );
                 duplicateBtrees.remove( tree.getRecordId() );
 
+                recMan.commit();
+
                 return;
             }
             else
@@ -828,6 +839,8 @@ public class JdbmTable<K, V> extends Abs
                     LOG.debug( "<--- Remove AVL {} = {}", name, key );
                 }
 
+                recMan.commit();
+
                 return;
             }
         }
@@ -943,6 +956,8 @@ public class JdbmTable<K, V> extends Abs
     {
         long recId = recMan.getNamedObject( name + SZSUFFIX );
         recMan.update( recId, count );
+        recMan.commit();
+
     }
 
 
@@ -1047,42 +1062,35 @@ public class JdbmTable<K, V> extends Abs
 
         TupleBrowser browser = tree.browse( key );
 
-        try
+        if ( isGreaterThan )
+        {
+            return browser.getNext( tuple );
+        }
+        else
         {
-            if ( isGreaterThan )
+            if ( browser.getPrevious( tuple ) )
             {
-                return browser.getNext( tuple );
+                return true;
             }
             else
             {
-                if ( browser.getPrevious( tuple ) )
-                {
-                    return true;
-                }
-                else
-                {
-                    /*
-                     * getPrevious() above fails which means the browser has is
-                     * before the first Tuple of the btree.  A call to getNext()
-                     * should work every time.
-                     */
-                    browser.getNext( tuple );
+                /*
+                 * getPrevious() above fails which means the browser has is
+                 * before the first Tuple of the btree.  A call to getNext()
+                 * should work every time.
+                 */
+                browser.getNext( tuple );
 
-                    /*
-                     * Since the browser is positioned now on the Tuple with the
-                     * smallest key we just need to check if it equals this key
-                     * which is the only chance for returning true.
-                     */
-                    V firstKey = ( V ) tuple.getKey();
+                /*
+                 * Since the browser is positioned now on the Tuple with the
+                 * smallest key we just need to check if it equals this key
+                 * which is the only chance for returning true.
+                 */
+                V firstKey = ( V ) tuple.getKey();
 
-                    return valueComparator.compare( key, firstKey ) == 0;
-                }
+                return valueComparator.compare( key, firstKey ) == 0;
             }
         }
-        finally
-        {
-            this.closeBrowser( browser );
-        }
     }
 
 
@@ -1098,8 +1106,6 @@ public class JdbmTable<K, V> extends Abs
             avlTree.insert( ( V ) tuple.getKey() );
         }
 
-        this.closeBrowser( browser );
-
         return avlTree;
     }
 
@@ -1129,13 +1135,4 @@ public class JdbmTable<K, V> extends Abs
 
         return bTree;
     }
-
-
-    private void closeBrowser( TupleBrowser<K, V> browser )
-    {
-        if ( browser != null )
-        {
-            browser.close();
-        }
-    }
 }

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyBTreeCursor.java
Fri Jan 18 15:49:27 2013
@@ -69,7 +69,7 @@ public class KeyBTreeCursor<E> extends A
         {
             LOG_CURSOR.debug( "Creating KeyBTreeCursor {}", this );
         }
-        
+
         this.btree = btree;
         this.comparator = comparator;
     }
@@ -95,7 +95,6 @@ public class KeyBTreeCursor<E> extends A
     public void before( E element ) throws LdapException, CursorException, IOException
     {
         checkNotClosed( "before()" );
-        this.closeBrowser( browser );
         browser = btree.browse( element );
         clearValue();
     }
@@ -107,7 +106,6 @@ public class KeyBTreeCursor<E> extends A
     @SuppressWarnings("unchecked")
     public void after( E element ) throws LdapException, CursorException, IOException
     {
-        this.closeBrowser( browser );
         browser = btree.browse( element );
 
         /*
@@ -152,7 +150,6 @@ public class KeyBTreeCursor<E> extends A
     public void beforeFirst() throws LdapException, CursorException, IOException
     {
         checkNotClosed( "beforeFirst()" );
-        this.closeBrowser( browser );
         browser = btree.browse();
         clearValue();
     }
@@ -164,7 +161,6 @@ public class KeyBTreeCursor<E> extends A
     public void afterLast() throws LdapException, CursorException, IOException
     {
         checkNotClosed( "afterLast()" );
-        this.closeBrowser( browser );
         browser = btree.browse( null );
     }
 
@@ -264,9 +260,8 @@ public class KeyBTreeCursor<E> extends A
         {
             LOG_CURSOR.debug( "Closing KeyBTreeCursor {}", this );
         }
-        
+
         super.close();
-        this.closeBrowser( browser );
     }
 
 
@@ -280,17 +275,7 @@ public class KeyBTreeCursor<E> extends A
         {
             LOG_CURSOR.debug( "Closing KeyBTreeCursor {}", this );
         }
-        
-        super.close( cause );
-        this.closeBrowser( browser );
-    }
-
 
-    private void closeBrowser( TupleBrowser browser )
-    {
-        if ( browser != null )
-        {
-            browser.close();
-        }
+        super.close( cause );
     }
 }

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/KeyTupleBTreeCursor.java
Fri Jan 18 15:49:27 2013
@@ -74,7 +74,7 @@ public class KeyTupleBTreeCursor<K, V> e
         {
             LOG_CURSOR.debug( "Creating KeyTupleBTreeCursor {}", this );
         }
-        
+
         this.key = key;
         this.btree = btree;
         this.comparator = comparator;
@@ -124,7 +124,7 @@ public class KeyTupleBTreeCursor<K, V> e
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
         }
-        this.closeBrowser( browser );
+
         browser = btree.browse( value );
         clearValue();
     }
@@ -141,7 +141,6 @@ public class KeyTupleBTreeCursor<K, V> e
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_446 ) );
         }
 
-        this.closeBrowser( browser );
         browser = btree.browse( value );
 
         /*
@@ -169,7 +168,6 @@ public class KeyTupleBTreeCursor<K, V> e
                  */
                 if ( !browser.getPrevious( valueTuple ) )
                 {
-                    this.closeBrowser( browser );
                     browser = btree.browse( this.key );
                 }
 
@@ -194,7 +192,6 @@ public class KeyTupleBTreeCursor<K, V> e
     public void before( Tuple<K, V> element ) throws LdapException, CursorException,
IOException
     {
         checkNotClosed( "before()" );
-        this.closeBrowser( browser );
         browser = btree.browse( element.getValue() );
         clearValue();
     }
@@ -215,7 +212,6 @@ public class KeyTupleBTreeCursor<K, V> e
     public void beforeFirst() throws LdapException, CursorException, IOException
     {
         checkNotClosed( "beforeFirst()" );
-        this.closeBrowser( browser );
         browser = btree.browse();
         clearValue();
     }
@@ -227,7 +223,6 @@ public class KeyTupleBTreeCursor<K, V> e
     public void afterLast() throws LdapException, CursorException, IOException
     {
         checkNotClosed( "afterLast()" );
-        this.closeBrowser( browser );
         browser = btree.browse( null );
     }
 
@@ -341,9 +336,8 @@ public class KeyTupleBTreeCursor<K, V> e
         {
             LOG_CURSOR.debug( "Closing KeyTupleBTreeCursor {}", this );
         }
-        
+
         super.close();
-        closeBrowser( browser );
     }
 
 
@@ -357,17 +351,7 @@ public class KeyTupleBTreeCursor<K, V> e
         {
             LOG_CURSOR.debug( "Closing KeyTupleBTreeCursor {}", this );
         }
-        
-        super.close( cause );
-        closeBrowser( browser );
-    }
 
-
-    private void closeBrowser( TupleBrowser browser )
-    {
-        if ( browser != null )
-        {
-            browser.close();
-        }
+        super.close( cause );
     }
 }

Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
(original)
+++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/NoDupsCursor.java
Fri Jan 18 15:49:27 2013
@@ -69,7 +69,7 @@ class NoDupsCursor<K, V> extends Abstrac
         {
             LOG_CURSOR.debug( "Creating NoDupsCursor {}", this );
         }
-        
+
         this.table = table;
     }
 
@@ -93,7 +93,6 @@ class NoDupsCursor<K, V> extends Abstrac
     public void beforeKey( K key ) throws LdapException, CursorException, IOException
     {
         checkNotClosed( "beforeKey()" );
-        this.closeBrowser( browser );
         browser = table.getBTree().browse( key );
         clearValue();
     }
@@ -102,7 +101,6 @@ class NoDupsCursor<K, V> extends Abstrac
     @SuppressWarnings("unchecked")
     public void afterKey( K key ) throws LdapException, CursorException, IOException
     {
-        this.closeBrowser( browser );
         browser = table.getBTree().browse( key );
 
         /*
@@ -170,7 +168,6 @@ class NoDupsCursor<K, V> extends Abstrac
     public void beforeFirst() throws LdapException, CursorException, IOException
     {
         checkNotClosed( "beforeFirst()" );
-        this.closeBrowser( browser );
         browser = table.getBTree().browse();
         clearValue();
     }
@@ -182,7 +179,6 @@ class NoDupsCursor<K, V> extends Abstrac
     public void afterLast() throws LdapException, CursorException, IOException
     {
         checkNotClosed( "afterLast()" );
-        this.closeBrowser( browser );
         browser = table.getBTree().browse( null );
         clearValue();
     }
@@ -298,9 +294,8 @@ class NoDupsCursor<K, V> extends Abstrac
         {
             LOG_CURSOR.debug( "Closing NoDupsCursor {}", this );
         }
-        
+
         super.close();
-        closeBrowser( browser );
     }
 
 
@@ -314,17 +309,7 @@ class NoDupsCursor<K, V> extends Abstrac
         {
             LOG_CURSOR.debug( "Closing NoDupsCursor {}", this );
         }
-        
-        super.close( cause );
-        closeBrowser( browser );
-    }
-
 
-    private void closeBrowser( TupleBrowser browser )
-    {
-        if ( browser != null )
-        {
-            browser.close();
-        }
+        super.close( cause );
     }
 }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLog.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLog.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLog.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/provider/ReplicaEventLog.java
Fri Jan 18 15:49:27 2013
@@ -26,6 +26,7 @@ import java.io.IOException;
 
 import jdbm.RecordManager;
 import jdbm.recman.BaseRecordManager;
+import jdbm.recman.TransactionManager;
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.schema.SchemaManager;
@@ -120,6 +121,8 @@ public class ReplicaEventLog implements 
         File replDir = directoryService.getInstanceLayout().getReplDirectory();
         journalFile = new File( replDir, REPLICA_EVENT_LOG_NAME_PREFIX + replicaId );
         recman = new BaseRecordManager( journalFile.getAbsolutePath() );
+        TransactionManager transactionManager = ( ( BaseRecordManager ) recman ).getTransactionManager();
+        transactionManager.setMaximumTransactionsInLog( 200 );
 
         SerializableComparator<String> comparator = new SerializableComparator<String>(
             SchemaConstants.CSN_ORDERING_MATCH_MR_OID );

Modified: directory/apacheds/trunk/protocol-ldap/src/test/java/org/apache/directory/server/ldap/JournalTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/test/java/org/apache/directory/server/ldap/JournalTest.java?rev=1435201&r1=1435200&r2=1435201&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/test/java/org/apache/directory/server/ldap/JournalTest.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/test/java/org/apache/directory/server/ldap/JournalTest.java
Fri Jan 18 15:49:27 2013
@@ -27,6 +27,7 @@ import java.io.File;
 
 import jdbm.RecordManager;
 import jdbm.recman.BaseRecordManager;
+import jdbm.recman.TransactionManager;
 
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.csn.Csn;
@@ -129,7 +130,8 @@ public class JournalTest
 
         dbFile = File.createTempFile( getClass().getSimpleName(), "db", tmpDir );
         recman = new BaseRecordManager( dbFile.getAbsolutePath() );
-        ( ( BaseRecordManager ) recman ).disableTransactions();
+        TransactionManager transactionManager = ( ( BaseRecordManager ) recman ).getTransactionManager();
+        transactionManager.setMaximumTransactionsInLog( 200 );
 
         SerializableComparator<String> comparator = new SerializableComparator<String>(
             SchemaConstants.CSN_ORDERING_MATCH_MR_OID );



Mime
View raw message